How lithikhab/distributed-rate-limiter works
This Spring Boot service applies a shared fixed-window rate limit to /api/** requests. The request path identifies clients by IP, checks an atomic Redis counter, then either stops with HTTP 429 or proceeds to the endpoint. Limits come from external configuration. The README documents the Redis and response flow; source excerpts show interceptor invocation, configuration registration, and the service’s Redis script. Other than those documented links, unsampled wiring is not inferred.
Main entry points: RateLimitInterceptor.java Rate interceptor · RateLimiterService.java Rate limiter · PingController.java Ping endpoint · RateLimiterProperties.java Limit properties
Components 8
Request handling
- Rate interceptor
src/main/java/com/lithikha/rate_limiter/RateLimitInterceptor.java - Ping endpoint
src/main/java/com/lithikha/rate_limiter/PingController.java - Web registration
src/main/java/com/lithikha/rate_limiter/WebConfig.java
Limit enforcement
- Rate limiter
src/main/java/com/lithikha/rate_limiter/RateLimiterService.java - Redis
Configuration
- Limit properties
src/main/java/com/lithikha/rate_limiter/RateLimiterProperties.java - Limit settings
src/main/resources/application.yml
Other components
- HTTP client
Connections 10
- HTTP client → Rate interceptor: sends request
README.md - Web registration → Rate interceptor: registers for /api/**
src/main/java/com/lithikha/rate_limiter/WebConfig.java - Rate interceptor → Rate limiter: checks limit
src/main/java/com/lithikha/rate_limiter/RateLimitInterceptor.java - Rate limiter → Redis: runs atomic script
README.md - Redis → Rate limiter: returns count
README.md - Rate limiter → Limit properties: reads limits
src/main/java/com/lithikha/rate_limiter/RateLimiterService.java - Limit settings → Limit properties: configures
README.md - Rate interceptor → Ping endpoint: allows request
README.md - Rate interceptor → HTTP client: returns 429
README.md - Ping endpoint → HTTP client: returns response
README.md