A distributed rate limiting service built with Java, Spring Boot, and Redis.
VelocityGuard helps protect APIs and backend services from abuse by enforcing configurable rate limits across multiple application instances. The service supports multiple rate-limiting strategies and provides a REST API for dynamic configuration and monitoring.
- Distributed rate limiting using Redis
- Multiple algorithms:
- Token Bucket
- Sliding Window
- Fixed Window
- Leaky Bucket
- Dynamic configuration management
- REST API for rate limit checks
- Redis-backed shared state
- Prometheus metrics support
- Docker deployment support
- Thread-safe implementation
- Horizontal scalability
- Java 21
- Spring Boot 3
- Redis
- Maven
- Docker
- Prometheus
Client
|
v
Rate Limiter Service
|
v
Redis
The service stores rate-limiting state in Redis, allowing multiple application instances to share limits consistently across a distributed environment.
- Java 21+
- Redis
- Maven
git clone https://github.com/<your-username>/velocityguard.git
cd velocityguard
./mvnw spring-boot:runcurl http://localhost:8080/actuator/healthcurl -X POST http://localhost:8080/api/ratelimit/check \
-H "Content-Type: application/json" \
-d '{
"key":"user:123",
"tokens":1
}'{
"allowed": true,
"remainingTokens": 9
}Allows burst traffic while maintaining a steady refill rate.
Provides accurate request tracking within a moving time window.
Simple and memory-efficient rate limiting strategy.
Processes requests at a constant rate and smooths traffic spikes.
Application metrics are available through:
/actuator/health
/actuator/metrics
/actuator/prometheus
docker build -t velocityguard .
docker run -p 8080:8080 velocityguard- Dashboard for real-time monitoring
- Rate limit analytics
- Multi-region Redis support
- Advanced policy management
MIT License