Design a Global Rate Limiter

System Design
Medium
Stripe
31K views

Design a system to throttle user requests globally across distributed servers. Discuss common algorithms (Token Bucket, Leaky Bucket), deployment strategies, and using a centralized store like Redis.

Why Interviewers Ask This

Interviewers at Stripe ask this to evaluate your ability to design resilient distributed systems under strict consistency constraints. They specifically test your understanding of global state management, latency trade-offs in centralized stores like Redis, and your capacity to select appropriate algorithms like Token Bucket for fair throttling across geographically dispersed servers.

How to Answer This Question

1. Clarify Requirements: Define scope immediately—global vs. regional limits, per-user vs. per-IP, and strict vs. eventual consistency. Mention Stripe's need for financial-grade reliability. 2. Propose Core Algorithm: Select Token Bucket for its flexibility in handling burst traffic, explaining why it fits payment processing better than Leaky Bucket. 3. Architecture Design: Sketch a client-side proxy or middleware that communicates with a centralized Redis cluster. Discuss sharding strategies to handle massive scale. 4. Address Consistency & Failover: Explain how to handle clock skew between regions and propose a fallback mechanism if the central store becomes unavailable. 5. Optimize & Scale: Discuss connection pooling, pipelining for Redis, and monitoring metrics to prevent false positives or system bottlenecks.

Key Points to Cover

  • Explicitly choosing Token Bucket over Leaky Bucket for burst tolerance
  • Using Redis Lua scripts to guarantee atomicity during token consumption
  • Addressing the latency-consistency trade-off in multi-region deployments
  • Defining clear failure modes and fallback strategies for store outages
  • Connecting the technical solution to Stripe's specific need for payment reliability

Sample Answer

To design a global rate limiter for a platform like Stripe, I would first clarify the requirements. We need to limit requests globally, not just per server, likely focusing on API endpoints handling payments. The goal is…

Common Mistakes to Avoid

  • Ignoring the difference between local and global state, leading to race conditions
  • Suggesting database polling instead of Redis for real-time token updates
  • Failing to discuss how to handle clock synchronization across different time zones
  • Overlooking the performance cost of cross-region network calls in the architecture

Sound confident on this question in 5 minutes

Answer once and get a 30-second AI critique of your structure, content, and delivery. First attempt is free — no signup needed.

Try it free

Related Interview Questions

Browse all 190 System Design questionsBrowse all 57 Stripe questions