Skip to content
Preptima
hardDesignConceptMidSeniorStaff

You need to enforce 100 requests per minute per API key across a fleet of forty servers. Which limiting algorithm, and where does the counter live?

8 min readUpdated 2026-08-15

Answer

Short answer

Fixed windows permit twice the limit across a boundary; the two sliding windows fix that at a memory or an accuracy cost; token bucket permits a bounded burst and leaky bucket smooths output instead.

Keep rate limiting explicit in the answer because that is the concept the interviewer is actually trying to test. A good rate limiting explanation names the trade-off, the failure mode, and the evidence you would use before choosing. Use rate limiting once more at the decision point so the answer reads as judgement rather than a detached example.

Was this answer helpful?

Likely follow-ups

  • How would you support a burst allowance of 500 with a sustained rate of 100 per minute, and what would you tell the client in the response?
  • Where in the request path does the limit belong when you also need per-tenant fairness on a shared worker pool?
  • How would you rate-limit by cost rather than by count when one endpoint is a thousand times more expensive than another?
  • What changes if the limit must be enforced exactly, for billing purposes, rather than approximately for protection?

Related questions

Further reading