Menu

Post image 1
Post image 2
Post image 3
1 / 3
0

Designing a Rate Limiter: 4 Algorithms, Real Trade-Offs

DEV Community·Gabriel Anhaia·about 1 month ago
#OiigIrJs
Reading 0:00
15s threshold

Book: System Design Pocket Guide: Interviews Also by me: System Design Pocket Guide: Fundamentals My project: Hermes IDE | GitHub — an IDE for developers who ship with Claude Code and other AI coding tools Me: xgabriel.com | GitHub You ship a rate limiter on a Friday. By Monday you're paged: legitimate batch jobs hit the wall every hour on the dot, and a few aggressive clients drain their quota in under a second and go quiet. Same algorithm, two opposite failure modes, both predicted by the choice you made the week before. Rate limiting is not a single problem. It's four problems that share a name. Token bucket, leaky bucket, fixed window counter, sliding window — each one optimizes for a different property, and each one breaks in a way the others don't. Pick the wrong one for your traffic shape and either your users complain or your downstream services do. What you're actually limiting Before the algorithms, the dimension. "100 requests per minute" hides three orthogonal questions you have to answer.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More