ferd / backoff Goto Github PK
View Code? Open in Web Editor NEWSimple exponential backoffs in Erlang
License: MIT License
Simple exponential backoffs in Erlang
License: MIT License
Please could you tag a release.
Would it be possible to publish backoff
to hex.pm?
When trying to compile backoff 1.1.5 I get these warnings:
→ DEBUG=1 rebar3 compile
===> Load global config file /Users/benoitc/.config/rebar3/rebar.config
===> Expanded command sequence to be run: [{default,app_discovery},
{default,install_deps},
{default,lock},
{default,compile}]
===> Provider: {default,app_discovery}
===> Provider: {default,install_deps}
===> Verifying dependencies...
===> Provider: {default,lock}
===> Provider: {default,compile}
===> run_hooks("/Users/benoitc/BarrelProject/backoff", pre_hooks, compile) -> no hooks defined
===> Compiling backoff
===> run_hooks("/Users/benoitc/BarrelProject/backoff", pre_hooks, compile) -> no hooks defined
===> run_hooks("/Users/benoitc/BarrelProject/backoff", pre_hooks, erlc_compile) -> no hooks defined
===> erlopts [debug_info,{d,'OLD_RANDOM'}]
===> files to compile ["/Users/benoitc/BarrelProject/backoff/_build/default/lib/backoff/src/backoff.erl"]
src/backoff.erl:45: Warning: random:uniform/1: the 'random' module is deprecated; use the 'rand' module instead
src/backoff.erl:62: Warning: random:uniform/1: the 'random' module is deprecated; use the 'rand' module instead
src/backoff.erl:134: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
src/backoff.erl:134: Warning: random:seed/1: the 'random' module is deprecated; use the 'rand' module instead
src/backoff.erl:135: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
src/backoff.erl:135: Warning: random:seed/1: the 'random' module is deprecated; use the 'rand' module instead
===> Compiled backoff.erl
===> run_hooks("/Users/benoitc/BarrelProject/backoff", post_hooks, erlc_compile) -> no hooks defined
===> run_hooks("/Users/benoitc/BarrelProject/backoff", pre_hooks, app_compile) -> no hooks defined
===> run_hooks("/Users/benoitc/BarrelProject/backoff", post_hooks, app_compile) -> no hooks defined
===> run_hooks("/Users/benoitc/BarrelProject/backoff", post_hooks, compile) -> no hooks defined
===> run_hooks("/Users/benoitc/BarrelProject/backoff", post_hooks, compile) -> no hooks defined
I am using latest version of erlang 20.3.4:
→ erl
Erlang/OTP 20 [erts-9.3] [source] [64-bit] [smp:20:20] [ds:20:20:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
Eshell V9.3 (abort with ^G)
Hi, why is backoff:fail/1
returning {NewDelay, _}
and not {OldDelay, _}
? For me it would make more sense to return the current value and the updated backoff record with new value.
Thanks.
Each time I am trying to test my own code and fetch the backoff dependency it tries to compile proper which create 2 issues imo:
/_build/default/plugins/proper/src/proper_typeserver.erl:553: Warning: erlang:get_stacktrace/0 used following a 'try' expression may stop working in a future release. (Use it inside 'try'.)
_build/default/plugins/proper/src/proper_typeserver.erl:556: Warning: erlang:get_stacktrace/0 used following a 'try' expression may stop working in a future release. (Use it inside 'try'.)
_build/default/plugins/proper/src/proper_typeserver.erl:553: Warning: erlang:get_stacktrace/0 used following a 'try' expression may stop working in a future release. (Use it inside 'try'.)
_build/default/plugins/proper/src/proper_typeserver.erl:556: Warning: erlang:get_stacktrace/0 used following a 'try' expression may stop working in a future release. (Use it inside 'try'.)
Woiuld it be possible to have this plugin only set by the users in its own config file? For the second maybe also a newer version of proper is existing?
Once the maximum delay is reached using the jitter
type the delay is always the maximum. This leads to convergence if multiple processes using backoff delay communicate with a bottleneck. Once one processes gets queued behind another at the bottleneck they remain in sync for the next (maximum) backoff delay (and all future maximum delays). Because the grouping remains for future delays the effect snowballs and more processes join the batch leading to a thundering herd.
Obviously the same effect could occur with the normal
type but the jitter
algorithm should produce random delays to avoid this.
Using a fresh clone of this repo:
$ rebar --version
rebar 2.6.4 19 20161104_120301 No VCS info available.
$ rebar get-deps compile
Uncaught error in rebar_core: {'EXIT',
{function_clause,
[{code,which,
[{rebar3_proper,"0.5.0"}],
[{file,"code.erl"},{line,719}]},
{rebar_core,'-plugin_modules/3-lc$^0/1-0-',
1,
[{file,"src/rebar_core.erl"},{line,573}]},
{rebar_core,plugin_modules,3,
[{file,"src/rebar_core.erl"},{line,573}]},
{rebar_core,process_dir1,7,
[{file,"src/rebar_core.erl"},{line,244}]},
{rebar_core,process_commands,2,
[{file,"src/rebar_core.erl"},{line,93}]},
{rebar,main,1,
[{file,"src/rebar.erl"},{line,58}]},
{escript,run,2,
[{file,"escript.erl"},{line,757}]},
{escript,start,1,
[{file,"escript.erl"},{line,277}]}]}}
Same results with either OTP 18.0 or 19.2.
In my usage I count the number of retries R. I want to process an exponential backoff delay directly from this number R.
Why not offer an API such as:
1> backoff:increment(1).
2
2> backoff:increment(2).
4
3> backoff:increment(3).
8
This is the same as doing the recursive calls, but is more direct to use when working with a state tracking the number of retries.
The same with the jitter API: backop:exp_rand/1
and backop:exp_rand/2
.
I could do a PR if this makes sense.
Need to ensure backoff is compatible with erlang otp 26 because it uses multi_time_warp by default:
Time warp safe code - https://www.erlang.org/doc/apps/erts/time_correction.html#time-warp-safe-code
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.