Scaling Compute Instances
A practical lesson on choosing scaling strategies, configuring autoscaling, and balancing readiness, availability, and cost.
Two ways to add capacity
Vertical and both adjust compute capacity, but they change different things.
changes the capacity of one instance. For example, a database workload that benefits from a larger machine might be moved to a VM with more CPU or memory. This can be straightforward, but the instance has an upper size limit, and resizing may require a restart or other disruption. Even after it is enlarged, that one instance can remain a single point of failure.
changes the number of instances. A web service might add instances during a traffic surge and remove them when traffic falls. A can distribute requests across healthy instances. This approach can improve resilience when instances are spread across failure zones, but the application generally needs to handle requests across multiple machines. Stateless services are particularly suited to this: sessions and shared data are kept in external stores rather than on one instance.
The approaches can also be combined: use appropriately sized instances as a baseline, then change the instance count as demand changes. But adding application instances does not automatically remove a bottleneck in a database, network, storage system, or other dependent service. Scaling helps when the constrained resource is the one being scaled; it is not a general fix for every performance limit.
Automating capacity changes
changes capacity automatically in response to defined conditions. An instance group typically has three limits or targets: , the smallest number of instances to keep running; , the target number; and , a safety limit on how many can run. An autoscaler changes the instance count within these limits.
Policies can decide when to scale in different ways:
Metric-based policies respond to measures such as CPU utilization, request rate, or load-balancer demand.
Scheduled policies adjust capacity at expected busy or quiet times.
Predictive policies use observed patterns to prepare for forecast demand.
For example, an online shop could keep a minimum of two instances, add instances when demand is sustained above a threshold, and scale back toward its minimum after demand subsides. The example illustrates the policy’s logic: keep a baseline, add capacity when a persistent signal indicates greater demand, and remove excess capacity when demand eases.
The response cannot be instantaneous. New instances need time to launch, initialize, and become ready for traffic. If a policy reacts to a short-lived spike, it may add capacity unnecessarily; if it reacts too slowly, performance may degrade before new instances are ready. Thresholds and scale-in behavior therefore need to account for workload variation and startup delay. Monitoring and load tests can help determine whether the chosen signals reflect user experience and whether instances become ready quickly enough.
Designing for availability
More capacity does not, by itself, guarantee availability. An application can have many instances and still fail to serve requests if those instances are unhealthy, if traffic is routed to them, or if a failure leaves too little capacity.
Where the platform and workload support it, distribute instances across separate failure zones so capacity is not concentrated in one zone. Use health checks to identify unhealthy instances, and route requests only to healthy backends. These measures connect capacity to actual service: instances need to be available and able to receive traffic, not merely counted as running.
Keep enough to serve requests while new instances start or while a failure is handled. This baseline helps bridge the time before replacement capacity is ready. The appropriate amount depends on the workload; the key is to avoid treating scale-out as an immediate substitute for capacity already needed to handle traffic.
Balancing cost and demand
Scaling choices balance service capacity against spending. Removing instances during quiet periods can reduce waste, while excess capacity at peak times or an overly high minimum can raise costs. But setting the minimum too low may leave too little capacity during a surge, hurting availability or response time—especially while additional instances are starting.
A can limit unexpected spending. It also limits how far the system can scale: if demand exceeds that maximum, some demand may remain unserved or be delayed. Minimum and maximum settings are therefore practical boundaries with consequences for both cost and service.
Choose instance type and size using measured workload needs, not CPU alone. Then periodically review utilization and cost so that resource choices and capacity limits continue to fit the workload. Together, these practices help balance the cost of idle resources against the need to respond to peak demand.
: A distinct zone in which instances can be distributed to account for failures.
: A check that identifies whether an instance is healthy.