# bucket4j/bucket4j

Java rate limiting library based on token-bucket algorithm.

Repository: https://github.com/bucket4j/bucket4j
Canonical: https://ross.abutalabs.com/products/bucket4j
Homepage: https://bucket4j.com
Language: Java
License: Apache-2.0
License Family: permissive
Topics: token-bucket, hazelcast, rate-limiter, apache-ignite, jcache, infinispan, rate-limit, rate-limiting, oracle-coherence
Last push: 2026-07-23T15:14:57+00:00

## Health v2 (maintenance only)
Score: 88/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 94, release rhythm 72, longevity 100
- inputs: {"age_days": 4343, "days_push": 41, "days_rel": 106, "gap_med": 35, "n_releases_24m": 6}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2790, forks 326 (observed 2026-08-28T04:07:22.045209+00:00)

## What it is
Bucket4j is a Java rate-limiting library based on the token-bucket algorithm, offering lock-free, high-precision integer arithmetic implementations. It supports distributed rate limiting across JVM clusters via JCache-compatible grids like Hazelcast, Ignite, and Infinispan, as well as custom backends.

## Use cases
- rate limit api requests in java
- throttle requests per user in a spring boot app
- distributed rate limiting across a cluster of jvms
- implement token bucket throttling with hazelcast
- protect an endpoint from too many requests
- limit bandwidth consumption in a java service

## When to choose
- you need precise, high-performance rate limiting in a JVM application
- you need clustered/distributed rate limiting backed by JCache-compatible grids or databases
- you want lock-free concurrency and low GC overhead
- you need to change rate limit configuration at runtime

## When to avoid
- you need rate limiting in a non-JVM language
- you want a ready-made API gateway or proxy rather than an embedded library
- your use case is simple single-node throttling where a smaller utility would suffice

## Facets
- artifact type: library
- maturity: stable
- function: rate-limiting, caching, middleware
- domain: backend, developer-tools, microservices, apis
- platform: jvm, cross-platform
- tags: token-bucket, jcache, hazelcast, infinispan, apache-ignite, distributed-rate-limiting, java

## Member repositories
- bucket4j/bucket4j (main) score 88

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:07:22.045209+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T18:49:17.719688+00:00, confidence not recorded.
  - readme: https://github.com/bucket4j/bucket4j (fetched 2026-08-28T04:07:22.045209+00:00, sha 1e794f802c04)
  - homepage: https://bucket4j.com (fetched 2026-08-29T09:55:06.280714+00:00, sha b24b4cd99997)
  - site_page: http://bucket4j.com/previous-releases.html (fetched 2026-08-29T09:55:06.289533+00:00, sha a7c7c098e197)
- Data as of 2026-08-30T08:39:29.467469+00:00.
