Autoscaling
Autoscaling adds servers when load rises and removes them when it falls, so you pay for roughly what you use. It handles the daily rise and fall of traffic well. Interviewers probe what it can't do: react to a spike faster than a new server can start.
A beach café on a sunny day
A beach café manager has a list of part-time staff she can call in. When the queue passes ten people, she phones someone. They take half an hour to arrive, so she calls early. When it goes quiet, she doesn't send people home straight away: the next coach of tourists may be ten minutes off. She never runs with fewer than two staff, never more than eight, because that's all the counter fits. And when the forecast says heatwave on Saturday, she books staff on Friday.
- the manager and her part-time staff → the autoscaler and the servers it adds and removes
- the queue → the metric the autoscaler watches: CPU, requests per server, queue length
- "past ten people" → the target
- half an hour to arrive → start-up time: boot, start the app, warm up
- not sending people home at once → the scale-in delay, so it doesn't flap up and down
- two to eight → the minimum and maximum
- booking for the heatwave → scheduled or predictive scaling