Skip to main content

Keep your API fast—even at peak

Rate limiting and admission checks that help reduce overload and protect expensive work.

Reliable at peak

Set admission budgets for launch spikes and promos before excess work reaches your handlers.

Lower cloud costs

Fewer moving parts to run and monitor. Spend less on Redis and ops.

Dev‑first adoption

Add via SDK. Keep your stack. Clear limits your customers understand.

UNDERSTAND OVERLOAD · KEEP USEFUL WORK MOVING

Keep useful work moving.

For developers, architects, and managers: 27 narrated lessons on why services overload and how to protect them. No cloud experience required. Start with one request, or jump to any lesson.

Course map Lesson 18 of 27 Browse all lessons

Four chapters, one learning path. Read or listen in any order. ~41 minutes total · Times shown at 1×.

Keep enough capacity to finish work and recover.

  1. 01 A useful result starts with one request
  2. 02 Unfinished work grows when arrivals outrun completions
  3. 03 More waiting space does not make work finish faster
  4. 04 A timeout ends waiting, not necessarily the work
  5. 05 Retained work can exhaust a process’s memory
  6. 06 One failed copy can push its neighbors over capacity
  7. 07 Refuse new work while the application can still recover
  8. 08 Different compute platforms still have finite resources
  9. 09 A shared database failure can spread back into every app
  10. 10 Restore capacity before restoring full traffic
  11. 11 A circuit breaker stops repeating a failing call

Contain one customer's excess without punishing everyone.

  1. 12 One customer’s excess should not ruin another’s day
  2. 13 A rate limit checks one customer’s recent allowance
  3. 14 Copies and languages must share the same intended policy
  4. 15 Fairness helps contain damage without reserving every resource
  5. 16 A legitimate crowd can exceed shared capacity

Reduce work entering a shared dependency when it slows.

  1. 17 Measure the operation whose pressure you want to observe
  2. 18 A shared tracker observes; a guard decides; your app acts You are here
  3. 19 Even the fastest recent observations can become slow
  4. 20 Separate local histories can reopen into the same burst
  5. 21 Replace optional expensive work before refusing essential work
  6. 22 A local breaker learns after calls have already piled up
  7. 23 Fast errors explain why the protections remain complementary
  8. 24 Latency feedback helps without measuring exact spare capacity

Choose, combine, and test the right protections.

  1. 25 Ask three different questions before expensive work
  2. 26 Recovery attempts need limits too
  3. 27 Measure useful service, not how much work you accepted

Read the explanation or use the course map above. Audio is optional.

18 / 27

A shared tracker observes; a guard decides; your app acts

Observation, decision, and call sequence

1Tracker observesShared reported durations1Tracker observesShared reporteddurations
  1. Tracker Shared observations

    Reported operation durations.

500 ms illustrates the comparison, not a recommended setting. Arrows are calls and replies. Your application calls the database directly; RateLimitly supplies decisions and receives reports.

Read the numbered steps in order. The explanation below follows the narration.

Keep observation, decision, and action distinct.

The tracker observes; the guard decides; your application enforces the decision.

0:00
Read transcript & diagram walkthrough

What you will learn

The tracker observes; the guard decides; your application enforces the decision.

A latency tracker is a shared record of reported operation durations. It observes. A guard is the check that uses those observations to decide whether new work may start. A threshold is the configured duration at which that guard refuses work. These are three distinct things: observations, a decision, and the application's action.

Before starting a protected database operation, the client asks for admission. With a positive threshold of five hundred milliseconds, a reported signal at five hundred or above causes the current guard to refuse. Setting this threshold to zero disables that latency guard; it does not mean refuse every request.

If admitted, the application does the database work, measures its duration, and reports afterward. If refused, it does not start that protected work. The client library does not automatically rewrite the application into a cheaper one. Your application handles the decision.

A tracker by itself does not stop anything. A guard checked after the expensive work is too late. Put the decision before the work it is meant to prevent, and make refusal a real branch in the program.

Diagram walkthrough
  1. First: the tracker observes reported durations.

    The tracker holds a shared record of measurements supplied by clients. Observing those durations is separate from making an admission decision or stopping application work.

  2. Second: the guard uses the observations to decide.

    The guard uses the tracker’s observations to decide whether new work may start. The measurement record and the admission check have different responsibilities; they are not interchangeable names for the same thing.

  3. A threshold sets the duration at which the guard refuses.

    The threshold supplies the guard’s configured comparison boundary. It is distinct from the observed durations: observations describe measured work; the threshold is the policy applied to those observations.

  4. Third: your application must act on the answer.

    Observations inform the guard, but application code must start or skip the protected operation. Merely recording a latency metric does not prevent work from reaching a database.

  5. Ask for admission before calling the database.

    Only the first side call exists at this step: application to RateLimitly. The database query has not begun. Put this check before acquiring or consuming the resource the guard is intended to protect.

  6. At or above 500 ms, this guard refuses new work.

    The comparison includes equality. Below this illustrative positive threshold, the latency guard allows on this signal; at 500 ms or above it refuses. Other required checks can still refuse an operation.

  7. Zero disables this guard; it is not a zero-time deadline.

    The zero setting is an explicit configuration exception. It disables this latency guard rather than refusing every nonzero-latency operation. It does not disable other required admission checks.

  8. Allow lets the application make the measured database call.

    Follow the direct application-to-database call. RateLimitly is a separate admission side call, not a proxy carrying the query. The result and subsequent report have not been shown yet.

  9. Measure across the chosen database-work boundary.

    The result returns directly from the database to the application. Measure from the agreed start to finish; this is the duration of the protected work, not the duration of the admission side call.

  10. Only after measuring the work does the application report duration.

    The last arrow reports the measured duration from the application to RateLimitly. That observation can inform future admissions; it does not retroactively prevent or cancel the work just measured.

  11. The application does not start the protected database work.

    The refusal comes back to application code, which does not start that database operation. There is no query arrow to the database on this branch. Return a correct cheap fallback or an explicit refusal.

  12. Your application implements the refusal branch.

    The library does not automatically rewrite an expensive request into a cheap alternative. Your application handles the answer and must not perform the same protected operation while pretending to fall back.

  13. Observing without acting is not load shedding.

    All three responsibilities are needed: an observation, a guard decision, and application code that obeys it. Recording durations while unconditionally running the expensive operation leaves that work unprotected.

  14. Check before work, not after the cost has already been paid.

    Return to the first call in the sequence. A guard evaluated after a database operation cannot prevent that operation. Test the refused path by checking that the protected call was never made.

Content revision: 07c7dd00db17

Download review copy (27 lessons)
Check your understanding & apply it

You report durations but never check before work. Is the database protected by those reports alone?

Show the explained answer

No. Reports provide observations. An admission check and an enforced refusal branch are needed before new work.

Integration guidance

Use the same API key with matching tracker identities and settings across client libraries. Check before the protected operation, branch on the result, and report measured admitted work afterward.

Where the promise stops

A positive threshold refuses at equality or above; zero disables this guard. A tracker is not an automatic proxy or application rewrite.

Technical depth & sources

Concepts used here

Implementation detail

Thresholds belong to the guard and need not be part of tracker identity; operations can use different thresholds against the same shared observations.

Original explanation inspired by Fred Hébert and operational references; no endorsement implied.

AI-generated narration: ElevenLabs Eleven v3, Daniel stock voice. Audio streams only when you start listening.

ElevenLabs

Why teams choose us

Happier customers
Consistent response times when it matters most.
Faster delivery
Ship features, not DIY limiters and brittle ops workarounds.
Clear controls
Per‑tenant and per‑route limits your stakeholders can reason about.

Engineering blog

View all posts →

Why you shouldn’t use Redis as a rate limiter: Part 1 of 2

A tour of the common Redis-based rate limiter implementations — and the correctness and performance traps each one hides.

Auto-Scaling Won’t Save You

The myth of infinite serverless scale — why adding machines doesn’t fix overload, and what to do instead.