Skip to content
Ameen Abozaid
Planned lessonMID-034-L03

Distributed rate limiting

  • Lesson 3 of 6
  • Mid-level
On This Lesson 4 topics

This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.

In this lesson

make limits correct across several instances.

Planned topics

  • An in-memory limiter behind a load balancer gives each instance its own counter: the real limit is multiplied by the instance count.
  • Use a shared store (commonly Redis with an atomic script) or enforce at a single edge such as the gateway.
  • Atomicity matters: read-modify-write races let extra requests through.
  • Accept approximation: local buckets that sync periodically trade accuracy for speed.
  • Decide failure behavior when the store is down: fail open (allow) or closed (reject), per endpoint risk.
Draft outline details

Demonstration

a diagram: three gateway instances sharing one Redis counter per customer; request flow with allow or 429.

Check your understanding

Why is a per-instance in-memory limit wrong for a limit of 100/min with 3 instances?

Show answer

Each instance allows 100, so up to 300 in total.

Practice

Apply this lesson with the module's lab, exercises and quiz.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.