---
answer: direct
beat: system-design
source: 1 article · updated: August 6, 2026
---

What is the time complexity of token bucket rate limiting?

Token bucket is O(1) time per request and O(1) space per client. The key is lazy refill: compute available tokens only when a request arrives, using elapsed time since the last refill. No background timer thread is needed; no timestamp log is stored per request.

Answered in

Token Buckets: Bounding Rate Limits at the Edge

Fixed-window counters leak at boundaries. Token buckets refill steadily, absorb bursts, and bound the sustained rate strictly—the algorithm Stripe uses.

Crashtech Editorial August 6, 2026 System Design & Architecture

Read the full analysis

Other questions this article answers

More system design & architecture questions

Every answer on Crashtech is written by the editor of the article it comes from — never auto-summarised. Browse all answers or the System Design & Architecture beat.