smyte / ratelimit

Smyte's high-performance rate limiter
Other
267 stars 25 forks source link

ratelimit

No longer maintained: Please note that this code is no longer being actively maintained.

A high-performance rate limiter written in C++ that speaks Redis protocol. See our blog post to learn more.

Building from source

Running it

Once compiled (as above), the binary lives at ./bazel-bin/ratelimit/ratelimit.

It takes a few options:

Example: ./bazel-bin/ratelimit/ratelimit --rocksdb_db_path ratelimit-data --rocksdb_create_if_missing

You can also run it inside docker: docker run -p 9049:9049 smyte/ratelimit

Supported commands

Example

Start the compiled server (see section on running it)

Send it some traffic:

$ redis-cli -p 9049 RL.REDUCE twoPerMin 2 60
(integer) 2
$ redis-cli -p 9049 RL.REDUCE twoPerMin 2 60
(integer) 1
$ redis-cli -p 9049 RL.REDUCE twoPerMin 2 60
(integer) 0