Rate Limiting

Rate Limiting

  1. What and why
  2. Token bucket algorithm
  3. Implementation
  4. Usage

Shall we retry?

Or wait?

Will our users wait?

Return a cached value?

Problem space - Throttling API

One bad client ruins it for everyone :(

Problem space - DoS attack

🔥

Problem space - Long-running data migration

🔒

Unresponsive

application

Solution space - taking control

Problem space - Throttling API

Problem space - DoS attack

Problem space - Long-running data migration

The Token Bucket algorithm

Let's build a rate limiter

By Lorenzo Barasti

Let's build a rate limiter

  • 834