finds.dev← search

// the find

wangzheng0822/ratelimiter4j

★ 966 · Java · Apache-2.0 · updated Feb 2023

Java rate limiting library/framework

A Java library for rate limiting HTTP endpoints by app ID, supporting both in-memory (single node) and Redis-backed (distributed) fixed time window algorithms. The SPI plugin architecture lets you swap in custom rule parsers, algorithms, and config sources. Aimed at Java 8+ Spring apps that need per-API rate limits without pulling in a full gateway.

The SPI extension model is a genuine design win — you can plug in a custom rule parser or algorithm without touching library code. Zookeeper support for centralized rule management is a reasonable choice for teams already running it. The exception hierarchy (OverloadException, InvalidUrlException, InternalErrorException) is clean and makes it easy to handle throttled requests distinctly from configuration errors. Test coverage is unusually thorough for a library of this size, with integration tests and JMH benchmarks included.

Only fixed time window is implemented — no token bucket, no sliding window, no leaky bucket. Fixed window has the well-known burst problem at window boundaries and the roadmap admits this is still '未开发' (not developed) three years later. The distributed limiter uses Jedis (blocking, connection-pool-based) with no Lettuce or reactive option, which will be a friction point for anyone on Spring WebFlux. The project is effectively abandoned — last commit was February 2023, with a roadmap full of P1 items marked undone including Redis Cluster support, which means you can't use the distributed mode in any serious production Redis setup without forking it yourself.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →