forge-kit

forge-throttle

Overview

forge-throttle provides deterministic, production-grade rate limiting and throttling for HTTP services.

It is designed for zero-trust environments and makes rate limiting explicit, testable, and predictable under load.


Key Features


Design Principles


Typical Use Cases


Usage

forge-throttle provides a RateLimiter abstraction and a reference filter implementation. You have two options:

Enable the provided ReferenceRateLimitingFilter by setting:

forge.rate-limit.reference.enabled=true

The filter is automatically wired in and requires no additional code. It:

Option 2: Implement a Custom Filter

If you need custom behavior (e.g., additional logging, metrics, or key resolution), implement your own filter following the pattern of the reference implementation.

Configuration

Configure rate limits in application.properties:

# Capacity per minute
rate-limit.authenticated-capacity-per-minute=100000
rate-limit.unauthenticated-capacity-per-minute=10000

# Refill rate per second
rate-limit.authenticated-refill-per-second=10000
rate-limit.unauthenticated-refill-per-second=1000

Examples

See: examples/forge-throttle for configuration examples.

See the reference implementation:

This example demonstrates:

See also: