CS PAPERS DEEP-READ · PAPER 61

Autopilot: Workload Autoscaling at Google

Rzadca et al. · University of Warsaw & Google · EuroSys 2020

中文 →

What this paper did

In 2020 Google described Autopilot — a system that decides, on its own, how much memory and CPU every program gets, so engineers no longer have to. By the time of writing it already governed more than 48% of the resources used across Google's fleet, and it cut the share that is reserved but never actually used from 46% down to 23%. Counted in machines, that is tens of thousands of them.

Start with something odd

The biggest waste in the cloud is usually not machines sitting idle. It is capacity that somebody reserved and then never touched.

You launch a service, and the platform asks you to fill in a form: how much memory does this need? how much CPU? Honestly — nobody knows. And the two ways of being wrong are wildly unequal. Ask for too little and your program gets killed the moment it exceeds its memory, or throttled to a crawl when it exceeds its CPU, and you are the one woken at 3am. Ask for too much and there is one more line on a bill nobody reads out loud.

So everybody asks for too much. Each person is being perfectly reasonable; added up, it is an astronomical amount of idling. Cloud waste comes less from scaling too slowly than from people being unable to fill in that form.

The idea

Autopilot's idea is so plain it is almost boring: stop making people guess. The system watches what every program actually uses, day after day, and fills the number in itself — and keeps changing it. Your electricity company does not ask you to declare next month's consumption; it reads your past usage and sets your tier.

So how does it pick the number?

Three steps, each of them close to ordinary common sense.

First, keep a ledger: for every program, a record of what it used in the past — in which the older entries fade. One freak spike from a Tuesday last month should not hold today's quota hostage forever.

Second, two resources, two different appetites for risk. For memory, take the historical peak: going over means being killed on the spot, and that is not a bet you can take. For CPU, take "the line it stays under almost all of the time": going over merely means running slower for a while, which is survivable, so there is no reason to pay for the highest spike ever seen. Then add a little safety headroom on top.

Third, when unsure, hold a vote. There is more than one sensible rule for picking that number — ledgers can fade faster or slower, headroom can be thinner or fatter. So Autopilot simply runs several rules at once and makes each of them replay the last few weeks: "if we had listened to you back then, how much trouble would you have caused, and how much would you have wasted?" Whichever rule has the best books gets the loudest voice. And changing its mind costs something too, so it does not flip between rule A and rule B day after day.

The hard part isn't the algorithm

"Set the quota from past usage" is an idea anyone can have. What makes this paper valuable is that it worked in a real environment of a hundred thousand machines — and that engineers were willing to let go of the wheel.

The trick is that the asymmetry is written into the rules in plain sight: cutting too close is scored as far more expensive than wasting, so the scales are deliberately tilted. That comes with a careful rollout: simulate on history first, then run silently without taking effect, then a small controlled comparison, then a gradual handover with a one-click way out. The result is the counter-intuitive part: it did not kill more programs, it killed fewer — the number of programs badly hurt by running out of memory dropped by about ten times, because the numbers people had guessed were worse than the machine's estimates.

One honest caveat: it can only extrapolate from history. A program launching for the first time, or one whose shape suddenly changed, has no history to copy — it has to start from a conservative default.

Remember this one thing

Cloud waste is mostly not "scaling too slowly" — it is people guessing their resource requests wrong, because guessing low gets you punished and guessing high does not. Autopilot hands the form to a machine: read the fading history of real usage, take the peak for memory and a high percentile for CPU, add a safety margin, and let several rules replay history to see whose choices would have cost least. Google runs nearly half its fleet this way; waste fell from 46% to 23%, and programs were killed for memory less often, not more.

Want the decaying-histogram algorithm, the cost function behind the multi-model recommender, and the measured numbers? → Switch to the deep read