Try
↑ ↓ move↵ openesc close

Curriculum · Module 04, Rate Limiting and Backpressure

Lesson 1 · 7 topics · 37 min · Beginner · 0/7 done

Rate limiting algorithms

Five ways to count requests, and what each one allows through when traffic comes in bursts.

What each topic covers

  • One caller can use up a shared service. A limiter decides, request by request, who gets in.
  • Fixed window, sliding log, sliding counter, token bucket and leaky bucket, and the state each one keeps.
  • Send one edge-straddling burst through all five limiters and compare what each lets through and what it stores.
  • Measured worst-case bursts, what a strict limit rejects, and the memory each limiter keeps per caller.
  • Weigh the previous window by its overlap, run the arithmetic on real counts, and see exactly when the estimate is wrong.
  • Charge expensive calls more tokens, choose the key with care, and layer per-key, per-address and global limits without double-charging.
  • Three checks on hard caps, clumpy traffic and per-user state, plus the standards and papers behind limiters.

Topics

  1. 1Why callers need a limit4 min
  2. 2Five ways to count5 min
  3. 3Race five limiters across a window edge7 min
  4. 4What each limiter admits at the edge6 min
  5. 5The sliding counter, worked by hand6 min
  6. 6Pricing requests and stacking limits5 min
  7. 7Choosing a limiter under pressure4 min

Practise this lesson

13 interview questions on rate limiting algorithms, with worked answers and sources.

Practise these

Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms