GOAT EngineerPreparing your learning space…

System Design · Concept Library · Free article

Distributed Rate Limiting — one true count across many servers

Why a limit that is perfect on one server is a lie on ten — and how to make a scattered count tell one true story. From what a rate limiter is up through the algorithms, where to enforce, the local-vs-shared-counter leak, 429s and headers, failure modes, and when not to — for interns through principal engineers.

A rate limiter caps how many requests a client may make in a window — the bouncer at your system’s door that turns away abusive traffic cheaply, before it can pile up and starve real users. The default algorithm is the token bucket: a bucket holds up to N tokens and refills at a steady rate; each request spends one, and an empty bucket means "slow down" (an HTTP 429). The depth is the burst you tolerate, the refill is the steady rate you enforce. The hard part in a real system isn’t the algorithm — it’s that your count is scattered. When a pool of servers each keeps its own counter, a client spread across 50 of them can hit each one up to the limit and get 50× the real limit. The fix is one shared, authoritative count (a central Redis) that every server checks, so no node is fooled by only seeing its slice of the traffic. Everything else — where to enforce it, how accurate the count has to be, what happens when the counter store dies — is a trade between speed and truth.

One link goes viral, and a botnet shows up

A Hatch link hits the front page of a big forum, and within minutes something ugly rides in on the traffic: a botnet discovers it can POST /urls to mint spam links, and starts firing 50,000 fake requests a second. Each one wants a database write. Your app servers in US-East and APAC dutifully try to process every last piece of junk, threads fill up, and now a real person clicking "Shorten" waits five seconds for a screen that used to answer instantly. The site isn’t down — it’s drowning.

The tempting fix is to throw hardware at it: add more app servers, buy a bigger database. But look closely at what you’d be paying for — more capacity to process garbage. The bots scale for free; you don’t. Every dollar of servers you add is a dollar spent chewing through requests you never wanted. The real move is the opposite of "handle more": it’s to refuse the junk, as early and as cheaply as you can, so it never reaches the expensive parts of your system at all. You put a bouncer at the door — something that counts how fast each client is knocking and turns away the ones asking for too much, too fast.

Count each client, allow under the limit, refuse the rest

The mechanism, in plain words, is a tally. For each client you keep a running count of how many requests they’ve made recently. A new request comes in: you look at their count, and if it’s under the limit you let the request through and add one to the tally; if it’s at or over the limit, you turn the request away. That’s the whole idea. The client that’s over their allowance doesn’t get an error page that looks like something broke — they get a specific, polite signal that means "you’re fine, just too fast, try again shortly." On the web that signal is the status code HTTP 429, "Too Many Requests", usually with a Retry-After header telling them how long to wait.

So where’s the difficulty? Two places, and this page is really about both. The first is the word "recently" — "100 per minute" sounds exact until you ask which minute, and the answer to that is what separates the different rate-limiting algorithms (up next). The second is the word "count" — keeping a single honest tally is trivial on one server and surprisingly treacherous once you have a whole fleet of them, which is the distributed problem the chapter is named for. We’ll take them in that order: first the algorithms, then the count.

The algorithms — token bucket and its cousins

There are five classic ways to enforce a rate, and they all answer the same question — "has this client had too much, too fast?" — but they differ in one thing: how they tolerate a burst. Some let a quiet client save up and spend a chunk at once; some force a perfectly smooth trickle; some just count per clock-tick and have a famous hole at the boundary. You only need two of them in depth, because they’re the ones you’ll actually reach for, and the other three are best understood as a comparison. Start with the default.

The token bucket. Picture a small bucket next to each client that holds up to a fixed number of tokens — say 10. Every request has to take one token to proceed; if the bucket has a token, the request goes through and the token is gone, and if the bucket is empty, the request is refused with a 429. The trick is how the bucket refills: it drips new tokens back in at a steady rate — say 2 per second — up to its maximum of 10. Two numbers, and they mean two very different things. The bucket’s depth (10) is the biggest burst you’ll tolerate: a client who’s been quiet has a full bucket and can fire 10 requests back-to-back. The refill rate (2/s) is the steady pace you actually enforce over time: once the bucket’s drained, they can only go as fast as it refills. The math is a single line — on each request, first top the bucket up by elapsed_seconds × refill_rate (capped at the depth), then spend a token if one’s there.

That’s why the token bucket is the default for most real APIs: it matches how people actually behave. Humans and healthy clients are bursty — they sit idle, then do a flurry of things — and the token bucket welcomes exactly that (spend your saved-up tokens) while still capping the long-run average. It also costs almost nothing to store: just two numbers per client (how many tokens, and when you last refilled), which in a real system you keep in Redis so every server shares them. Play with it below — drain the bucket with a burst and watch it refuse requests, then let it sit and refill:

The interactive version of this example is available when JavaScript loads.

The leaky bucket. Its cousin looks similar but enforces the opposite temperament. Here requests pour into a queue (the bucket), and the bucket leaks them out at a fixed, constant rate — one every half-second, say — no matter how fast they arrive. If the queue fills up, new requests spill over and are rejected. The point of the leaky bucket isn’t to count so much as to smooth: whatever jagged, bursty traffic goes in, a perfectly even trickle comes out. That’s exactly what you want when the thing downstream is fragile and needs a steady drip — an old payment gateway, a rate-capped third-party API, hardware that hates spikes. The cost is that it flattens legitimate bursts too (a real client’s flurry gets paced out instead of served at once) and it adds queueing delay. So the rule of thumb: token bucket when you want to allow bursts, leaky bucket when you need to erase them.

The other three are all variations on the simplest possible idea — keep a counter and reset it every so often — and they trade memory for precision. A fixed window keeps one counter per clock interval (all requests from 12:00:00–12:00:59 share a counter that resets at 12:01:00). It’s the cheapest thing that works, but it has a notorious hole: a client can fire a full limit’s worth at 12:00:59 and another full limit’s worth at 12:01:00 and sail through double the limit in two seconds, because the counter reset between them. The sliding window log closes that hole perfectly by storing the timestamp of every request and counting only those in the last 60 seconds — exact, but the memory grows with traffic. The sliding window counter is the practical middle: it blends the current and previous window’s counts by how far you are into the window, killing almost all of the boundary burst for a fraction of the memory. Those window mechanics — and that boundary burst — get their own full treatment in the companion Sliding Window Counter page; here’s how the five line up:

The five rate-limiting algorithms at a glance. Token bucket is the default; the rest are chosen for a specific need.
AlgorithmHow it tracks timeBurstsMemory / clientReach for it when
Token bucketTokens refilling at a steady rateAllows a burst up to the depthTiny (2 numbers)The default — bursty-but-capped APIs
Leaky bucketA queue draining at a constant rateErases them — smooth outputSmall (queue length)Protecting a fragile, spike-averse downstream
Fixed windowOne counter per clock intervalLeaks ~2× at the boundaryTiny (1 counter)Cheap internal limits where a 2× burst is fine
Sliding window logA timestamp per requestNone — exactHigh (grows with traffic)Security-critical limits needing exactness
Sliding window counterWeighted blend of two windowsAlmost none — approximateSmall (2 counters)High-scale APIs wanting accuracy on a budget

Where to put the bouncer

A request travels through several layers before it reaches your code: it leaves the browser, hits a CDN or edge point-of-presence, arrives at your load balancer / API gateway, and only then lands in an app server running your business logic. You can enforce a rate limit at any of those layers — and the single most useful instinct is earlier and cheaper is better, because a request you reject has already cost you everything it touched on the way in. Turn the bots away at the door and they never burn a database connection; turn them away deep in your service and you’ve already paid for the connection, the thread, and the memory just to say "no."

The four places you can limit, from outermost to innermost

  • In the client (the app or SDK) — polite and cheap, but never a defense: an attacker just deletes your check. Use it to stop well-behaved clients from being accidentally abusive, not to stop anyone who’s trying.
  • At the edge / CDN — the cheapest place to shed a flood, because it’s stopped before it even enters your network (this is where DDoS and WAF protection live). Great for coarse, brutal limits ("no IP gets more than X"). It has the least context, though — it doesn’t know your users or your business rules.
  • At the load balancer / API gateway — the sweet spot for most limits, and where Hatch puts its bouncer. It’s a single chokepoint in front of the whole pool, it can see the client’s IP and API key, and it can share one counter across every backend. Enough context to be smart, early enough to be cheap.
  • In the service (middleware) — the most context of all: per-user quotas, per-endpoint rules, "this plan gets 1,000/day." But it’s the most expensive place to say no, since the request has already reached your app. Reserve it for fine-grained business limits, not for shedding raw abuse.

But notice the catch hiding in that "single chokepoint": your gateway isn’t one box. For the same reasons your app servers are a pool — you need more than one for capacity and for surviving a failure — your gateway is a pool too, often spread across regions. And the moment the thing enforcing the limit is itself many machines, we’re back to the problem the whole chapter is named for: the count is split.

A limit that’s perfect on one node is a lie on ten

Here’s the trap, and it’s so simple it’s almost embarrassing. Say you enforce "100 requests per minute per client" at the gateway, and your gateway is a pool of 50 nodes behind a load balancer. Each node keeps its own counter in local memory — fast, no network hop, feels great. Now a client’s requests arrive and the load balancer, doing exactly its job, sprays them evenly across all 50 nodes. Each node sees only its slice of the traffic — about 1/50th — so each node’s local counter has to climb to 100 before that node blocks anything. Multiply it out: the client sails through 50 × 100 = 5,000 requests before the limit "kicks in." You meant 100. You got 5,000.

The unsettling part is that the attacker doesn’t have to be clever. They don’t target specific nodes or exploit anything — plain round-robin load balancing hands them the multiplier for free. Drag the fleet size below and watch the limit you meant to enforce drift away from the limit you actually get:

The interactive version of this example is available when JavaScript loads.

The fix is the whole point of the chapter: stop letting each node keep its own private tally, and give them all one shared, authoritative counter to check — a central store, almost always Redis, that holds the single true count for each client. Now it doesn’t matter whether the pool has 2 nodes or 500: every node increments and checks the same number, so the client is blocked at exactly 100, globally. The scattered count finally tells one true story. What you pay for that truth is a network round trip on every check — the nodes now have to talk to agree — and how much of that price you actually need to pay is the next question.

How exact does the count have to be?

The shared counter is exact, but exactness has a bill. Every single request now makes a round trip to Redis to check and increment the count — and at Hatch’s 50,000 requests a second, that’s 50,000 Redis operations a second and roughly a millisecond added to every request just to ask permission. Sometimes that’s exactly right and worth every microsecond. Sometimes it’s a waste, because a little imprecision would cost you nothing. The senior move is to notice that "how accurate does this limit need to be?" is a real question with different answers, and to price it against what an overage would actually cost. There are three points on that dial:

  • Synchronous central — check the shared counter on every request. Perfectly exact, but you pay the round trip every time. The right choice when an overage is a genuine problem: login attempts, password resets, payment endpoints.
  • Local + periodic sync — each node counts locally (no per-request hop) and reconciles its totals with Redis every second or so. Latency drops to almost nothing; in exchange a client can slip a bounded amount over the limit in the gap between syncs. Perfect for smoothing high-volume abuse where a few percent of slop is harmless.
  • Token pre-fetch (batch lease) — a node grabs a whole batch of tokens from Redis at once (say 100) and serves them locally until they run out, only going back for more when it does. The fewest hops of all, and the coarsest: a node can be sitting on a batch of tokens another node could have used. For extreme throughput where the exact ceiling can be loose.

Feel the trade below — pick a strategy and drag the fleet size. Watch the exact-but-slow option pin the overage to zero while it taxes every request, and watch the two local options nearly erase the latency while letting a bounded overage creep in that grows with the number of nodes:

The interactive version of this example is available when JavaScript loads.

Say no politely: 429, Retry-After, and the headers

When you turn a request away, how you say no matters more than it looks. The standard answer is the status code HTTP 429, "Too Many Requests" — and picking it deliberately is the point, because it says something specific: "there is nothing wrong with your request or my server; you are simply going too fast." That’s a different message from a 500 (I broke) or a 503 (I’m overloaded), and clients — and your own dashboards — treat it differently. A 429 is a rate signal, not an error.

A bare 429 still leaves the client guessing when to come back, and a guessing client hammers you. So you pair it with a Retry-After header that says exactly how long to wait — a number of seconds, or a date. That turns "try again... whenever?" into a contract a well-behaved client can honor, backing off instead of retrying in a tight loop and making your flood worse. Better still, the best APIs don’t make clients wait to hit the wall at all: they send the rate-limit state on every response so a good client can slow itself down before it’s blocked. Stripe and GitHub both do this. The de-facto headers:

The rate-limit response headers — a 429 with Retry-After is the floor; the X-RateLimit-* trio lets clients self-throttle before they’re ever blocked.
HeaderWhat it tells the clientExample
Retry-AfterHow long to wait before retrying (seconds, or a date)Retry-After: 30
X-RateLimit-LimitYour ceiling for the window100
X-RateLimit-RemainingHow many you have left right now3
X-RateLimit-ResetWhen the window refills (a timestamp)1719800000

Two nuances round it out. First, rejecting is not the only option — a 429 drops the request cheaply, but you can also delay it (queue it and release it at a steady rate, the leaky-bucket move from earlier) when the client is worth serving late rather than not at all. Dropping protects you under attack; delaying is kinder to legitimate bursts. Second, tell clients to retry with exponential backoff and jitter: if every throttled client waits the exact same amount and retries in unison, you’ve just built yourself a synchronized stampede at Retry-After seconds. A little randomness spreads the retries out.

When the bouncer’s clipboard catches fire

The shared counter you added to make the count true has a cost you can’t ignore: it’s now a hard dependency on your hot path. Every request checks it, so if that Redis gets slow or falls over, it doesn’t just stop limiting — it can drag down every request that was waiting on it. The most important question a rate-limiter design has to answer isn’t about the happy path at all; it’s what do you do when you can’t reach the count? And there are exactly two answers, with opposite blast radii.

Fail-open means: if the limiter can’t reach the store, let the request through anyway. Your real users never feel the outage — but for as long as the store is down, there is no rate limit at all, and abuse pours straight through to your app. Fail-closed means the opposite: if you can’t verify the count, refuse the request. Abuse is stopped cold — but so is every legitimate, paying customer, so a hiccup in one Redis has just become a full-blown outage you inflicted on yourself. Flip both switches below and watch who wins:

The interactive version of this example is available when JavaScript loads.

There’s no universally right answer, only the right answer for this limit — but the common, safe default is fail-open with a coarse local fallback: if the shared count is unreachable, fall back to a rough per-node in-memory limit (yes, it leaks N×, but N× a small number still beats no limit) rather than either locking everyone out or throwing the doors wide open. Reserve fail-closed for the limits where an overage is genuinely worse than downtime — login attempts, password resets, payments. And whichever you choose, put the limiter check behind a tight timeout: a Redis that takes 500ms to answer is nearly as bad as one that’s down, and the moment that timeout fires is your fail-open-or-closed decision, so make it deliberate.

The other gotchas worth naming

  • The counter is a hot key. For a viral link or a single abusive IP, one Redis key gets hammered by your entire fleet at once — the classic write-hot key that pins a single core. It’s the same problem as a viral click-counter, and the same fixes apply (see Hot Keys & Partition Skew).
  • Clock skew. Sliding windows and token refills reason about time, and two servers’ wall clocks disagree by milliseconds. Lean on the store’s own clock (or a logical time) for the window boundary rather than each node’s local clock, or a client can gain or lose a sliver of quota depending on which node they hit.
  • Thundering herd at the reset. A fixed window resets everyone’s quota at the same instant (12:00:00), so a horde of clients that hit their limit all surge again together the moment it flips — a self-made traffic spike. Token bucket and sliding windows smooth this out because there’s no shared reset line; it’s one more reason to prefer them.
  • It’s in every request’s critical path. The check has to be O(1), pipelined, and fast — a rate limiter that adds 5ms to every request is a tax you pay a billion times a day. Cheap-to-check is a feature, not an afterthought.

Is the bouncer actually working?

A rate limiter fails silently, which is what makes it dangerous. A broken one that accidentally allows everything looks exactly like a calm, healthy system — right up until the flood it was supposed to stop arrives. A too-tight one that’s quietly throttling real customers looks like "traffic is a bit low today" — until the support tickets pile up. Neither failure announces itself, so you have to instrument the one thing that matters: the decision itself. Emit a metric on every allow and every deny, and watch these:

  • 429 rate — overall, and broken down per client and per endpoint. A sudden spike is an attack or a broken client stuck in a retry loop; a slow, steady creep is organic growth bumping into a limit you set long ago (time to raise it).
  • *False positives — 429s to your authenticated, paying users.* This is the scariest number on the dashboard, because it means you’re throttling the people who give you money. Alert on it directly; it should be near zero.
  • Headroom — the p99 of each client’s actual request rate versus the limit. It tells you how much slack normal traffic has before it hits the wall, so a limit change never surprises you.
  • Store health — the limiter Redis’s latency and availability, and whether any single counter key is running hot. When this degrades, your whole door does.

And the debugging classic, because you will get this ticket: "I keep getting 429s and I’m barely doing anything." Nine times out of ten it’s one of two things. Either a crowd of users sits behind a single shared IP — an office, a NAT, a mobile carrier gateway — and they’re all colliding on one per-IP limit (fix: key by user or API key, not raw IP). Or the client has a retry loop with no backoff, so its first 429 triggers an instant retry that triggers another, turning one throttle into a self-inflicted DDoS (fix: backoff with jitter, on their side and yours).

The cost, and when not to reach for it

A rate limiter isn’t free, and a good engineer names the bill before reaching for one: a store to run and pay for, a hop of latency on every request, real engineering complexity, and — easy to forget — added risk, because you’ve introduced a new dependency (and a new way to fail closed) in front of the very system you were trying to protect. Most of the time that’s a trade well worth making. But sometimes rate limiting is the wrong tool, and the senior move is knowing when something else fits better:

  • Trusted, internal service-to-service traffic — you usually want a concurrency limit or backpressure (bound the number of in-flight requests) or a queue, not a requests-per-minute cap. You control both sides; shape the flow instead of counting it.
  • Protecting a fragile downstream — a leaky bucket / queue that paces the load, or a bulkhead that isolates it, often beats a hard reject, because the goal is a steady drip, not a "no."
  • Controlling the cost of an expensive operation — if you’re limiting to stop a pricey API from bankrupting you, the honest lever is quotas and billing tiers, a product decision, not a reactive throttle.
  • Plain old too-much-legitimate-traffic — that’s a capacity problem, and the answer is more machines, not a limit. Never use a rate limiter as a substitute for capacity you should have provisioned.

How the real world does it

You almost never build a rate limiter from scratch — you configure one that already exists, and knowing where they live is half the interview. Here’s the map, from the edge inward:

Where rate limiters live in a real stack — most systems use several layers at once.
LayerWhat you’d useWhat it’s good at
Edge / CDN / WAFCloudflare, Fastly, AWS WAFCoarse per-IP limits + DDoS — the cheapest place to shed a flood
API gatewayKong, Envoy / Istio, AWS API Gateway, nginx limit_reqToken/leaky bucket built in; one chokepoint in front of the pool
Shared storeRedis (INCR / sorted set, or the redis-cell module)Holds the one true count every node checks
App / libraryFramework middleware, resilience librariesFine-grained per-user, per-plan business quotas

Two names worth stealing from. Stripe and GitHub both run token-bucket-style limits and expose the X-RateLimit- headers so clients can self-throttle — a good template to copy. And one algorithm you’ll hear in senior interviews: GCRA (the Generic Cell Rate Algorithm) is a token-bucket-equivalent* that stores a single timestamp — a "theoretical arrival time" — instead of a running count and a refill step. It gives you smooth limiting in O(1) memory with no background refill, and it’s the trick behind the popular redis-cell module. Same behaviour as a token bucket, less to store.

Show me the code

Here’s the shape of a distributed token-bucket check in words you can turn into any language. The one non-negotiable: the refill-and-spend must happen as a single atomic step, or two nodes reading the same count at the same instant will both see a token left and both let their request through — the read-modify-write race. On Redis that’s a tiny Lua script; the exact commands live on the Redis page, and why that atomicity is the whole game is its own companion page.

  1. Key the client by the strongest identity you have: rate:{apiKey} (fall back to rate:{ip} only for anonymous traffic).
  2. Read the bucket’s two numbers for that key: tokens and lastRefill (a timestamp).
  3. Refill lazily — no background timer: tokens = min(capacity, tokens + (now - lastRefill) * refillRate), then set lastRefill = now.
  4. Decide: if tokens >= 1, do tokens -= 1 and allow; otherwise reject with 429 and Retry-After: ceil((1 - tokens) / refillRate).
  5. Write tokens and lastRefill back — and wrap steps 3–5 in one atomic Lua script so no two requests can race between the read and the write.
  6. Give the key a TTL so idle clients evict themselves — a full bucket is the default, so a forgotten key costs nothing.

Pitfalls that bite in production

  • Local per-node counters — the headline mistake: a client spread across N nodes gets N× the limit for free.
  • Limiting by raw IP alone — offices and NATs share one IP (false positives that throttle real users), and attackers rotate IPs (false negatives). Key by user / API key wherever you can.
  • A fixed window on a public endpoint — the 2× boundary burst is a known exploit; use a token bucket or sliding window for anything user-facing.
  • A 429 with no Retry-After — you leave the client guessing, and a guessing client retries in a tight loop and makes your flood worse.
  • Retries with no jitter — every throttled client waking up at the same instant rebuilds the exact stampede you just shed.
  • Failing closed by accident — never letting the failure mode be an unexamined default; a single Redis blip should not be able to take your whole product down.
  • No metric on the decision — a limiter you can’t observe is a limiter you can’t trust; a broken one is invisible until it’s a headline.

Best practices

  • Default to a token bucket; reach for leaky bucket or a sliding window only when a specific need (smoothing, exactness) demands it.
  • Enforce at the gateway with a shared store for most limits; add coarse limits at the edge and fine-grained business limits in the service, each where it fits.
  • Key by the strongest identity available (API key or user id), falling back to IP only for anonymous traffic.
  • Always return 429 + Retry-After, and expose the X-RateLimit-* headers so well-behaved clients throttle themselves before they hit the wall.
  • Put the check behind a tight timeout with a decided fail-open/closed fallback — fail-open plus a coarse local limit is the usual safe default; fail-closed for security-critical limits.
  • Make limits configurable per plan and per endpoint without a deploy — a limit is a product decision that will change, so don’t bake it into code.
  • Instrument every allow/deny, and alert specifically on 429s to paying users.

The interview deck — intern to principal

What is a rate limiter, and why do you need one? (intern)
It caps how many requests a client can make in a window, so you can shed abusive traffic, enforce fairness between clients, and protect your app from being overwhelmed. Over-limit requests get a 429 Too Many Requests, ideally with a Retry-After.
Which algorithm would you pick? (intern → SDE2)
Token bucket by default — depth sets the allowed burst, refill sets the sustained rate, and it welcomes the bursty traffic real clients produce. Leaky bucket when you need a perfectly smooth output for a fragile downstream. Sliding window when you need exactness and want to avoid the fixed-window boundary burst.
Where would you enforce it? (SDE2)
At the API gateway with a shared store for most limits — one chokepoint with enough context (IP, API key) to be smart. Coarse limits at the edge/CDN to shed obvious junk cheaply, and fine-grained business quotas in the service. Earlier is cheaper to reject; later has more context.
How do you keep the limit correct across many servers? (senior)
Don’t use local per-node counters — a client spread across N nodes gets N× the limit. Keep one shared, authoritative count in Redis that every node checks, and do the check-and-increment atomically (a Lua script) so concurrent requests can’t race past the read-modify-write.
That shared Redis is now on your hot path — what could go wrong? (senior → staff)
It’s a single point of failure and a hot key. Put the check behind a tight timeout, and decide fail-open vs fail-closed on purpose: fail-open with a coarse local fallback for availability (the usual default), fail-closed only where an overage is worse than downtime. Watch for clock skew and fixed-window reset stampedes too.
How would you make it fast enough for 50,000 QPS? (the meta / staff)
Cut the per-request hop: local counting with periodic sync to Redis, or token pre-fetch (lease a batch of tokens per node). Shard the counter keys so no single key is a hotspot, pipeline the Redis calls, and accept a bounded overage wherever an overage is cheap. It’s the accuracy-vs-latency dial, tuned by what an overage costs.
When would you NOT rate-limit, or do it differently? (principal)
Trusted internal traffic → concurrency limits / backpressure. A fragile downstream → a queue or leaky bucket. Cost control of an expensive API → quotas and billing. Too much legitimate traffic → that’s a capacity problem, so autoscale — don’t use a limiter as a substitute for capacity you should have.

The one thing to carry

The whole chapter collapses into a single sentence: the moment your count is spread across machines, a per-node tally is a lie. A client behind ten nodes gets ten times the limit you set, and the botnet doesn’t even have to try — the load balancer hands it the multiplier for free. The fix is to stop each node keeping its own private truth and give them all one shared, authoritative count to check, atomically. Everything else on this page — the token bucket, where you put the bouncer, how exact the count needs to be, what happens when the store dies — is a trade between speed, truth, and blast radius.

By GOAT Engineer. Back to Concept Library. Privacy Policy · Contact.