Skip to content
/ raterl Public
forked from g-andrade/raterl

An erlang ETS based rate limiter inspired by Jobs

License

Notifications You must be signed in to change notification settings

benoitc/raterl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

raterl

Erlang flow control application heavily inspired in jobs and ratx, ETS based bypasses the jobs_server single process bottleneck while providing rate and counter flow control.

Supports

TODO

  • Queues
  • Modifiers

Examples

Rate flow control

A typical use case is restricting the number of logins per second on a system, you'd start by the configuration:

[{raterl, [
    {queues, [
        {login_requests, [
            {regulator, [
                {name, max_login_rate}, 
                {type, rate},
                {limit, 100}   %% ensures that we get no more than x logins per second
            ]}
        ]}
    ]}
  ]
}].

Then on the code you ask permission from raterl before accepting a login:

    case raterl:run(login_requests, {rate, max_login_rate}, fun () -> Ret end) of
        limit_reached ->
            {error, throttled};
        Ret -> Ret
    end;

Build

$ rebar3 compile

About

An erlang ETS based rate limiter inspired by Jobs

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Erlang 94.3%
  • Makefile 5.7%