General questions
What is the difference between this and API gateway rate limiting?
What is the difference between this and API gateway rate limiting?
- Protect expensive internal operations (database queries, external API calls)
- Enforce business-specific limits (per-tenant, per-feature)
- Rate limit based on business context (user role, subscription tier)
- Protect service-to-service calls in microservices
- Protect against DDoS attacks
- Enforce global API quotas
- Rate limit based on IP address or API key
- Protect all backend services uniformly
Which Spring Boot and Java versions are supported?
Which Spring Boot and Java versions are supported?
- Java 17 or higher
- Spring Boot 3.x
- Redis 2.6+ (tested with Redis 7)
- Spring Boot 2.x (use Spring Boot 3.x)
- Java 11 or earlier (upgrade to Java 17+)
Does this work with Spring WebFlux/Reactive?
Does this work with Spring WebFlux/Reactive?
- Use the core rate limiting functionality
- Implement custom exception handling for reactive contexts
- Consider contributing WebFlux support to the project
Can I use this without Redis?
Can I use this without Redis?
- Fast atomic operations (INCR)
- Built-in TTL support for automatic key expiration
- Shared state across multiple application instances
- Production-proven for rate limiting use cases
- For in-memory rate limiting (single instance), consider Bucket4j or Guava RateLimiter
- For other distributed backends, you would need to implement custom
RateLimiterinterface
Configuration questions
What happens when Redis is unavailable?
What happens when Redis is unavailable?
How do I disable rate limiting globally?
How do I disable rate limiting globally?
@RateLimit annotations.Alternative: Use Spring profiles to disable in specific environments:Can I disable rate limiting for specific methods?
Can I disable rate limiting for specific methods?
enabled attribute on the annotation:- Temporarily disabling limits during testing
- A/B testing rate limit configurations
- Gradual rollout of rate limiting
What rate limit headers are included in 429 responses?
What rate limit headers are included in 429 responses?
ratelimiter.include-http-headers=true (default), the following headers are added:Retry-After: Seconds until the rate limit window resetsRateLimit-Limit: Maximum requests allowed in the windowRateLimit-Remaining: Requests remaining (0 when blocked)RateLimit-Reset: Unix timestamp when the window resets
Implementation questions
How does the key resolution work?
How does the key resolution work?
RateLimitKeyResolver implementations.Default resolver (DefaultRateLimitKeyResolver):- If
keyis set:scope:key - If
keyis not set:scope:fully.qualified.ClassName#methodName
Can I apply multiple rate limits to the same method?
Can I apply multiple rate limits to the same method?
How do I rate limit based on Spring Security user?
How do I rate limit based on Spring Security user?
Can I customize the HTTP 429 response format?
Can I customize the HTTP 429 response format?
Performance and scalability questions
What is the performance impact of rate limiting?
What is the performance impact of rate limiting?
- 1-2 Redis commands (INCR, possibly EXPIRE)
- Typical latency: 1-5ms for local Redis, 10-20ms for remote
- No Lua scripts, just simple atomic operations
ratelimiter.evaluate.latency timer to monitor performance:- Use Redis in the same data center/region
- Configure connection pooling appropriately
- Monitor Redis memory and CPU usage
How many requests can this handle?
How many requests can this handle?
- 50,000-100,000+ ops/sec typical
- INCR operations are very fast (O(1))
- Network latency to Redis
- Redis server resources (CPU, memory, network)
- Application server resources
- Use Redis Cluster for horizontal scaling
- Use Redis Sentinel for high availability
- Consider Redis caching for read-heavy workloads
- Use multiple Redis instances with sharding
Does this work in a multi-instance deployment?
Does this work in a multi-instance deployment?
Monitoring and metrics questions
What metrics are available?
What metrics are available?
ratelimiter.metrics-enabled=true:Counters:ratelimiter.requests- Total requests evaluated- Tags:
name,scope,outcome(allowed/blocked)
- Tags:
ratelimiter.errors- Backend errors (Redis failures)- Tags:
exception
- Tags:
ratelimiter.evaluate.latency- Time to evaluate rate limit- Tags:
name,scope
- Tags:
How do I monitor rate limit effectiveness?
How do I monitor rate limit effectiveness?
-
Block rate:
-
Top blocked operations:
-
Redis errors:
-
Latency trends:
- High block rate (may indicate attack or misconfigured limits)
- Redis connection errors
- High latency (Redis performance issues)