Token Bucket Rate Limiting with Redis
UML Sequence Diagrams · made in Skemio

What it shows
- Redis stores token counts and timestamps in a single atomic hash structure
- Atomic Lua scripts calculate refill math dynamically during request arrival
- Exceeded limits return 429 Too Many Requests with Retry-After header values
The takeaway
Compute refills lazily inside Redis Lua scripts instead of running background timers.
- #RateLimiting,#Redis,#SystemDesign,#Microservices,#APIs,#BackendArchitecture





