Definition · Autoscaling shortfallLet demand rise from a level the fleet already serves at a rate r requests per second per second, for a ramp of duration D. Let τ be the time between ordering an instance and it serving traffic. With no warm reserve, the shortfall — the number of requests demanded and not served — is
r·τ·(D − τ/2) for D ≥ τ,
which is the area between the demand line and the capacity line over the ramp.
The derivation is geometry. For the first τ seconds capacity does not move at all, so the gap grows linearly from zero to r·τ: a triangle of area ½·r·τ². After that, capacity rises at the same rate as demand but τ seconds later, so the gap is a constant r·τ for the remaining D − τ seconds: a rectangle of area r·τ·(D − τ).
r = 50 rps/s τ = 90 s D = 300 s base load 5 000 rps
triangle ½ · r · τ² = ½ × 50 × 8 100 = 202 500
rectangle r · τ · (D − τ) = 4 500 × 210 = 945 000
------------
total 1 147 500 requests
closed form r · τ · (D − τ/2) = 4 500 × 255 = 1 147 500 ✓
Both routes give the same integer, which is the check. The closed form is the area of a trapezoid: the mean of the two gaps — zero at the start and r·τ from the boot window on — taken over the ramp, with the τ/2 recording that the gap spent the first boot window opening rather than open.
What the area is made of
It is worth being exact about what 1 147 500 counts. It is not requests that were slow; it is demand that arrived while there was no capacity for it. Whether those requests queue, retry or fail is a property of the system in front of the fleet, and every one of those outcomes is bad in a different way.
moment λ μ in service ρ = λ/μ
t = 0 s ramp starts 5 000 5 000 1
t = 45 s mid-boot 7 250 5 000 29/20
t = 90 s τ: first ready 9 500 5 000 19/10
t = 300 s D: ramp ends 20 000 15 500 40/31
t = 390 s caught up 20 000 20 000 1
Every row above ρ = 1 is a row with no steady state. The backlog grows at λ − μ for as long as the row lasts, which at the worst instant is 4 500 requests a second. This is the same ρ as “λ, μ and ρ”, and the only thing this page adds is that μ must be the capacity in service rather than the capacity requested — the difference between those two is exactly the subject of the lesson.
The backlog never drains
Look at the last row. When the ramp stops, capacity catches up and the two lines end level at 20 000 rps. Level means no spare: there is no surplus with which to work through what accumulated, so the backlog built during the ramp is still there when the ramp is over. It drains only when demand falls, or never.
That is why “autoscaling handles spikes” is the wrong model. Autoscaling handles growth: given enough time it tracks a rising load with a fixed lag and a bounded gap. A spike is precisely the case where there is not enough time, and the mechanism arrives after the event it was meant to absorb.
Example · The reserve that removes it exactlyHold r·τ = 4 500 rps warm and the shortfall is zero, not small. The reserve covers exactly the capacity the boot window costs: for the first τ seconds it absorbs the growing gap, and by the time it is exhausted the first ordered instances are in service. Set the reserve to 2 000 rps instead and the shortfall is reduced rather than removed — the lab shades what is left.
A reserve is idle capacity, which is the waste of “Utilisation and Waste” deliberately bought. That is the honest framing of the trade: the shortfall is priced in requests and the reserve is priced in instance-hours, and choosing between them is a decision rather than an optimisation.
Two knobs change r·τ without buying a reserve, and both are worth more than they sound. Halving τ — a smaller image, a warmer pool, a faster health check — halves the gap and quarters the triangle. Scaling on a leading signal rather than on the utilisation that results from it starts the boot earlier, which is the same saving bought with a prediction instead of with money.