Code RoomDistributed rate limiter multi-tenant
HardPrep Room Coding #3433

Distributed rate limiter multi-tenant

System designNetworking & APIsAlgorithms & data structuresMid–Senior~40 min

You're building the rate limiter for a multi-tenant API gateway. Each customer has a plan limit (e.g. 1000 req/min) enforced across a fleet of 30 stateless gateway nodes behind a load balancer. Compare a token-bucket vs a sliding-window-log vs a sliding-window-counter approach for this case, then design the distributed enforcement: where the counter state lives, how you keep per-request latency under 1ms of added overhead, and how you handle burst allowance fairly without letting one customer get 30x their limit by hitting 30 nodes. Specify the consistency model you accept.

What a strong answer looks like

Clarify scale and constraints first. Propose a clean component breakdown, then go deep on the hard parts (data model, bottlenecks, consistency, failure modes) and name the trade-offs you are making.

Clarify4:30 left
Estimate4:30 planned
Design13:30 planned
Deep dive10:30 planned
Failure7:00 planned
0:00
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.