A Java library for rate limiting, assembled using extensible storage and application framework adaptors. The library's interfaces support thread-safe sync, async, and reactive usage patterns.
RateLimitJ provides the following stable plugable modules:
- Uses an efficient approximated sliding window algorithm for rate limiting
- Multiple limit rules per instance
Binaries and dependency information for Maven, Ivy, Gradle and others can be found at Maven Central.
Example for Maven:
<dependency>
<groupId>es.moki.ratelimitj</groupId>
<artifactId>ratelimitj-redis</artifactId>
<version>${ratelimitj-redis.version}</version>
</dependency>
- RateLimitJ requires Java 8
Feature | Status |
---|---|
Redis sliding window rate limiter | production |
Dropwizard integration - Bundle | stable |
In-memory sliding window rate limiter | stable |
In-memory concurrent rate limiter | beta |
Rate limiting toggles (dark launch) for framework integration | beta |
Hazelcast sliding window rate limiter | development |
Enhanced metrics logging | back log |
Whitelisting & blacklisting of keys | back log |
Rate limit HTTP header responses | back log |
Spring integration | back log |
RateLimitJ is built with Gradle and requires a local Redis for the Redis module.
Running docker-compose up -d
will start Redis.
To build:
$ git clone https://github.com/mokies/ratelimij.git
$ cd ratelimij/
$ docker-compose up -d
$ ./gradlew
This library was inspired by the following articles on sliding window rate limiting with Redis: