Skip to library content

Mock Interviews

Design a Quota Service

In this system design mock, the candidate designs a quota service for internal service callers, using a peak of one million quota checks per second as the scale target. The service must decide whether to allow or reject each request, while supporting configurable rules for different users and APIs.

The discussion follows that decision through API gateways and shared Redis counters. The follow-ups explore sharding, a single hot quota key, failures, cache expiry, policy updates, and atomic counter checks. In the debrief, Daniyal discusses the candidate’s enforcement-placement choices, their reasoning about alternative update mechanisms, and how a clearer transition from high-level design to deep dives would make the answer easier to follow.

Technical note: The count-and-time-window example shown in parts of this interview is a fixed-window counter. A token bucket refills and consumes tokens. The recording’s editorial notes clarify this distinction.

Interviewer assessment
Level
Senior
Verdict
Pass
Confidence
Moderate

Comments

The candidate led the discussion from requirements into a concrete design, explaining why quota enforcement belongs at the API gateway and why gateway replicas need shared counter state. They discussed Redis sharding and cache expiry, recognized the risk of updating the database and cache separately, and independently identified the need for atomic counter checks with Redis Lua.

To strengthen the answer, define how much quota overrun is acceptable during failures, how to protect a single hot quota key, and how updated rules reach every gateway within the agreed freshness target. Keep the fixed-window counter distinct from a token bucket, and make the transition from high-level design to deep dives explicit so the interviewer can follow the reasoning.