Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

Launch price

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year, or $19.50 for your first year with LAUNCH50, ends 1 Nov, 18:30 UTC.

See plansStart free instead

Module 10 · System Design · Six more low-level rounds

Design a rate limiter (the class inside the bouncer)

Design a Rate Limiter
Design a Rate Limiter · Open board

The bucket and its refill line, the arithmetic from empty, the swappable rules with a fake clock, and twenty servers sharing one limit.

Before you start. You need three earlier ideas. The bouncer at the door (rate limiting) showed the system-design view: a bouncer who counts requests per face and protects the slow thing behind him, and the saucer of coins called a token bucket. This lesson builds the bouncer’s notebook as classes. Swap the rule, keep the class (Strategy and Factory) gave you the strategy, one job with several interchangeable rules behind one method call. Two people, one seat (thread-safe booking) gave you the race condition and the lock. You need to read a little Python.

Lesson 47 of 73 in System Design

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year, or $19.50 for your first year with LAUNCH50, ends 1 Nov, 18:30 UTC.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • October 1986: a paper about bursts
  • Step one: ask before you draw
  • The saucer as a class: the token bucket and its refill
  • The same job, two rules: the sliding window
  • The clock you can reach: clock injection
  • What the interviewer adds: plans, and many servers

Terms it explains: leaky bucket, class, key, per-key limiter, capacity, refill rate, refill, log, window, sliding window, clock injection, One global lock, One lock per key, token bucket.

Review System Design