Brief #05 · Backend

Distributed Rate Limiter

Hard⏱ 14-20 hSoon

A rate limiter that stays fair when your API runs on ten pods, and fails safely when Redis doesn't answer.

Outlines are free · building with tracking needs Pro

DThe briefFrom the team

Each customer may call our public API 100 times a minute. The limit lives in each pod's memory, so with ten pods a customer actually gets 1,000. One scraper took us down last week. Make the limit global, accurate and fast.

What you'll build

  1. 1A token-bucket limiter in Redis using a Lua script so check-and-take is atomic.
  2. 2Middleware that returns 429 with Retry-After and rate-limit headers.
  3. 3Deploy three replicas on a local Kubernetes cluster (kind or minikube).
  4. 4A load test that proves the limit holds across pods.
  5. 5Choose and implement fail-open or fail-closed when Redis is unreachable.

Step-by-step walkthrough

Walkthrough coming soon

This project's step-by-step walkthrough, with real outputs at every step, is still being written. You can read the brief and try it on your own meanwhile; tracking opens when the walkthrough is ready.

Done when

  • Across 3 pods a client gets 100 requests per minute, give or take a few.
  • The limiter adds under 2 ms at p95.
  • Killing Redis triggers your chosen failure mode, and it's documented.
  • Kubernetes manifests and a README to run it all with one command.

Stretch goals

  • Different limits per plan (free, pro) read from config.
  • Compare token bucket and sliding window with graphs.

Show it off