Menu

Designing a distributed rate limiter: an interview walkthrough
📰

Designing a distributed rate limiter: an interview walkthrough

DEV Community: redis·bikash bhol·about 6 hours ago
#6XjS1Mu2
#devtoredis#devto#dev#design#gateway
Long article (424 words) — no AI summary yet.
Reading 0:00
15s threshold

"Design a rate limiter" is one of the most common system design interview questions, because it looks small and isn't. Here's a compact walkthrough of the version most interviewers expect: one limiter shared by many API gateway instances.

The problem

A public API with limits per API key and per endpoint: say 100 requests a minute on the free plan and 5,000 on paid. 50 gateway instances handle 500,000 requests a second between them, and the limiter may add only a few milliseconds.

Quick estimates

checks : 500,000 / s (one per request) active keys : ~10M, ~100 bytes per counter -> ~1 GB in memory Redis : ~100k simple ops/s per node -> 5-10 shards, plus replicas

Enter fullscreen mode

Exit fullscreen mode

Where it runs

As middleware inside the gateway, not as a separate service you call over the network on every request.…

Continue reading — create a free account

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