Bugpit

System design interview questions

Design a rate limiter

"Bots are hammering our API. Design something to protect it." You ask questions and learn: 9,000 req/s arrive, the budget allows 2 app servers, and they can answer about 4,000. You can't serve everyone, so the people you do serve must get a fast, real answer.

Practise this round

Part of Bugpit Pro. A 20 minute timed round in your browser: draw the design, run it against the traffic, then see the interviewer's checklist.

The question

9,000 requests a second at the peak, 10% of them writes. You have 20 minutes and every part on offer: servers, load balancers, caches, databases, queues and more.

How the round works

Like a real interview, the canvas starts empty and the checklist stays hidden until you submit. Bugpit then sends the traffic at your design, crashes a machine, and marks what held up, what fell over and what it would cost each month.

What a strong answer covers

Show it (try the round first)

An overloaded server doesn't just serve fewer people. Requests queue, time out and are retried, so it spends its time on work nobody is waiting for.

Put one front door in front of the servers and give it a limit. Requests over the limit are refused at once, which costs your servers nothing.

Set the limit to what the servers can really carry. Too high and they drown anyway. Too low and you turn away people you could have served.

Then talk about the parts a diagram can't show: a token bucket per user so one abuser can't use everyone's share, where the counters live when there are many gateways, and what the refused caller is told.

The point: A rate limiter protects what you have. It doesn't add capacity. Say that, and say where the counters are stored, and you've covered what most candidates miss.

Try it against the clock

More system design interview questions