c
chinmay
@cxinu
Rate Limiting at Warp Speed: How Nginx, Lua & Redis Keep Your APIs Alive
Submitted Apr 20, 2025
Topic of your submission:
Distributed systems
I am submitting for:
Speaking at Rootconf meetups
Type of submission:
15 mins talk
{Describe your talk/session in 2-3 paragraphs}
Modern distributed systems demand rate limiting that’s both consistent and performant, but traditional approaches—like in-memory counters or siloed cloud tools—struggle with scale. Static limits fail in dynamic environments, while centralized solutions risk bottlenecks. The challenge? Enforcing global quotas across nodes without sacrificing speed or reliability.
In this talk, I’ll share how I built a distributed rate limiter using Nginx’s high-performance proxy layer, Lua for embedded logic, and Redis for synchronized state. Lua scripts in Nginx handle per-request checks, leveraging Redis’s atomic operations (like INCR
and sliding windows) to track usage globally. Redis Cluster ensures horizontal scalability, while Nginx’s non-blocking design maintains low latency. I’ll cover key optimizations, pitfalls like network partitions, and how to balance strict limits with fault tolerance. Learn how this system enforces fairness, scales to thousands of requests/sec, and integrates with observability stacks—ideal for APIs, microservices, and SaaS platforms.
{Mention 1-2 takeaways from your session}
- Build scalable rate limiters using Nginx + Lua for logic and Redis for state—atomic operations (e.g., INCR, sliding windows) ensure consistency.
- Balance performance and reliability: Redis Cluster for scale, Lua coroutines for non-blocking checks, and graceful failure handling.
{Which audience segment is your talk/session going to beneficial for?}
Backend engineers, DevOps/SREs, and architects designing APIs, microservices, or SaaS platforms needing distributed traffic control.
{Add your bio - what you do; where you work}
A Generalist software developer, Presently an opensource contributor for neovide — Website
{{ gettext('Login to leave a comment') }}
{{ gettext('Post a comment…') }}{{ errorMsg }}
{{ gettext('No comments posted yet') }}