Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/liveforeverx/ratx
Rate limiter and overload protection for erlang application
https://github.com/liveforeverx/ratx
Last synced: 2 months ago
JSON representation
Rate limiter and overload protection for erlang application
- Host: GitHub
- URL: https://github.com/liveforeverx/ratx
- Owner: liveforeverx
- License: other
- Created: 2015-04-25T14:38:13.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-10-04T11:41:18.000Z (over 7 years ago)
- Last Synced: 2024-08-09T20:50:37.992Z (5 months ago)
- Language: Erlang
- Homepage:
- Size: 4.88 KB
- Stars: 20
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- freaking_awesome_elixir - Erlang - Rate limiter and overload protection for erlang application. (Miscellaneous)
- fucking-awesome-elixir - ratx - Rate limiter and overload protection for erlang application. (Miscellaneous)
- awesome-elixir - ratx - Rate limiter and overload protection for erlang application. (Miscellaneous)
README
# Ratx
The Ratx Erlang application provides overload protection for
Erlang systems. It provides queueing facilities for tasks to be
executed so their concurrency can be limited on a running
system.# Inspiration
Ratx owes its inspiration to Ulf Wigers `jobs` framework and
Jesper Louis Andersen `safetyvalve`, but it is a different
implementation and a different approach as well.The main difference and goal is to try to eliminate the one gen_server
process to handle all requests. And, the same as `safetyvalve` to
have one process per queue, which can be supervised(and restarted,
if something go wrong).`ets:update_counter/3` seems the best options and natural to try, and
heavily used in production for such use cases with good effort.Due to this change, the queue process should only handle all `done`-s,
and dropping of entries in a queue after timeout. If queue is full, no
messages or calls will be sent to a queue process, that is a protection
for a process on big birsts.# Using
Example of using
```erlang
ratx:start_link(test_queue, [{limit, 10}, {queue, 100}, {queue_timeout, 1000}]),
Action = fun(I, Time) -> io:format("~p..", [I]), timer:sleep(Time) end,
[spawn(fun() -> ratx:run(test_queue, fun() -> Action(I, 40) end) end) || I <- lists:seq(1, 30)], ok.
```