Saltar al contenido principal

The Load Went Away and It's Still Down: Metastable Failure

· 11 min de lectura
Clustron Team
Ingeniería de Sistemas Distribuidos

Most outages have the decency to end when their cause ends. The dependency comes back, the spike subsides, the bad deploy is rolled back, and the system returns to normal on its own. You can draw a straight line from cause to effect and back again. The failure that does not play by those rules — the one that keeps senior engineers up arguing about why the graphs will not move — is the one where the cause is long gone and the system is still face-down on the floor.

The shape is always the same. The system is running fine, comfortably under capacity. Some trigger arrives: a burst of traffic, a few seconds of dependency latency, a cold cache after a deploy, a node restart that briefly halves capacity. For a moment the system is overloaded, which by itself is survivable. But in that moment a feedback loop engages — and once it engages, it supplies its own fuel. The trigger passes, offered load drops back to the ordinary level the system was handling an hour ago, and goodput stays near zero. The system has fallen into a second stable state: overloaded, serving almost nothing, and perfectly content to stay there.

That is a metastable failure, and the word "stable" is the important half. The collapsed state is not a transient on its way back to health; it is an equilibrium the system will hold indefinitely until something external breaks the loop. This post is about why a system can have two equilibria instead of one, why the bad one sustains itself, and what actually gets you out.

Two stable states, and a trigger that flips between them​

A healthy system has a comfortable equilibrium: requests arrive, get served quickly, and leave, and the work in flight stays bounded. The subtle fact is that many systems have a second equilibrium hiding above their capacity line — a state where almost all the work is wasted effort, and the waste is exactly what keeps the system pinned there. Under normal conditions you never visit it, because you are sitting in the good state with margin to spare. The trigger's only job is to shove you across the line once. After that, the trigger is irrelevant; the second equilibrium holds itself up.

The mechanism that makes the bad state stable is a sustaining feedback loop: some response to overload that itself generates more load. The system gets slow, something reacts to the slowness in a way that adds work, the added work makes it slower, and the loop closes. Crucially, the amount of extra load the loop generates does not depend on the original trigger — it depends on how overloaded the system currently is. So removing the trigger changes nothing. The loop is now driven by the collapse, not by the cause, and it will keep driving the collapse as long as the collapse keeps feeding the loop.

The retry is the usual engine​

By far the most common sustaining loop is the humble client retry, and the reason is worth tracing carefully, because retries are not only harmless but helpful in the good state. When one request in a thousand fails transiently, retrying it costs almost nothing and hides the blip from the user. That is why retries are everywhere, usually with generous defaults.

Now watch the same retries in overload. The system slows down, so requests start timing out. Every timed-out request is retried — often two or three times — so each real request now lands as two or three requests. Offered load has just doubled or tripled, because the system is slow, which makes it slower, which times out more requests, which generates more retries. The server is also burning capacity on work that will be thrown away: it finishes a request a hair after the client gave up, and the response goes nowhere while a retry for the same work is already queued. Goodput — useful work that someone is still waiting for — collapses toward zero even as the server runs flat out at 100% CPU. Take the trigger away and the loop does not care; it is now powered entirely by the retries that the slowness is generating, and the slowness is generating them because of the retries.

goodputtime →overload triggerload back to normal…goodput stays floored (metastable)shed load, drop retriesrecoversThe loop that keeps it down — driven by the collapse, not the triggeroverloadrequests time outclients retryload ×2–3more load deepens the overload — the loop supplies its own fuel

Why the obvious fixes do not work​

The instinct in the collapsed state is to restart something, and restarting one node is usually worse than useless. The restarted node comes up empty and gets slammed by the full backlog of retries the instant it is healthy, so it is overloaded before it has served a single request, and it rejoins the collapse. Adding capacity has the same problem at a larger scale: because the retry load scales with how overloaded the fleet is, new nodes are absorbed into the bad equilibrium rather than lifting the fleet out of it. You can sometimes add enough capacity to break the loop, but the amount required is far more than the normal load would suggest, because you are not provisioning for the real traffic — you are provisioning for the real traffic times the retry amplification.

The reason none of this works is that none of it touches the loop. The system is not short of capacity in any honest sense; it is spending the capacity it has on retries of work that has already been abandoned. Until you cut the sustaining loop, every resource you add gets fed into it.

Getting out, and staying out​

What actually breaks the loop is starving it. The single most effective lever is a retry budget: cap retries as a small fraction of the request rate — say, ten percent — rather than letting each request retry on its own. In the good state, well under ten percent of requests fail, so the budget never binds and retries work exactly as before. In overload, the budget is exhausted almost immediately, retries stop being issued, offered load falls back to the real request rate, and the amplification that was sustaining the collapse simply disappears. A retry budget is the difference between a retry policy that helps in the small and poisons in the large, and one that helps in the small and goes quiet precisely when it would otherwise do the most damage.

// A retry without a budget is a load amplifier under stress.
if (retryBudget.TryAcquire()) // retries capped as a FRACTION of the request rate
return await Call(req, attempt + 1);
else
throw new Overloaded(); // shed instead of retrying — starve the loop

// And never retry work the caller has already abandoned:
if (req.Deadline.HasPassed) return; // finishing it wins nothing; it only burns capacity

Two companions finish the job. Load shedding gives the server the same discipline from the other side: when queues pass a threshold, reject new work fast and cheaply instead of accepting it and timing out, so the server spends its capacity on requests it can actually finish — a fast, honest rejection is what lets goodput survive overload instead of collapsing to zero. And backpressure — bounded queues with a prompt "busy" signal — is what prevents the tip in the first place, by refusing to let work-in-flight grow without limit during the trigger, so the system never crosses into the second equilibrium at all. Shedding and budgets get you out of the bad state; backpressure keeps you from falling in. Deadline propagation underpins all three: a server that knows a request's deadline has passed can drop it instead of producing a response no one is waiting for, which is the purest form of not wasting capacity on abandoned work.

Wrap-up​

A metastable failure is what you get when a system has two stable states and a trigger that can flip it from the good one to the bad one, where the bad one sustains itself long after the trigger is gone. The engine is almost always a feedback loop whose output scales with the depth of the collapse rather than with its original cause — most often retries, which are a quiet convenience in the good state and a load multiplier in overload, doubling or tripling offered load exactly when the system can least afford it. That is why restarting a node or adding a little capacity does nothing: the system is not short of resources, it is burning them on retries of abandoned work, and new resources are swallowed by the same loop. The way out is to starve the loop — a retry budget that goes silent under stress, load shedding that fails fast instead of timing out, and never retrying past a deadline — and the way to avoid it entirely is backpressure that refuses to let the tip happen. The deepest lesson is that reliability features can have different signs in different regimes: the retry that saves you at one request in a thousand is the same retry that pins you to the floor at one in two, and a system is only as recoverable as its willingness to stop doing work that no longer helps.