Stripe System Design Interview: API Rate Limiting Across a Server Fleet
Based on questions reported for Stripe interviews
The interviewer opens
Hi, and thanks for joining. Welcome to your interview for the software engineer role at Stripe. We'll design a system together, with you sketching on the whiteboard on the right as you talk, and you can pause anytime with the Pause button at the top right if you need a break.
The problem is a rate limiter for Stripe's public API, which matters because every payment request flows through that API. It's up in the Problem tab, so please read through it and ask anything you'd like clarified before you start drawing.
The problem
Design a rate limiter for Stripe's public API that caps how many requests each API key can make per time window (for example, 100 requests a minute), enforced consistently across the whole fleet of API servers handling that key's traffic.
Must do
- Enforce a configurable request limit per API key per time window
- Count a key's requests consistently no matter which API server receives them
- Reject over-limit requests with a clear rate-limit error and retry guidance
- Let limits differ per key and change without redeploying servers
Must hold
- Adds very little latency to every API request
- API keeps serving payments even when the limiter's store is slow or down