91. When would you scale vertically instead of horizontally?
Compare adding resources to one instance with adding more instances for a service approaching its current throughput limit. Address statefulness, parallelism, failover, scaling ceiling, startup time, load distribution, cost, and the measurements needed to show which resource boundary is limiting capacity.
I would measure the service first and find the resource that is actually limiting throughput. I would usually scale vertically when the limiting resource is inside one instance and the service has state that is hard to share, or when the work does not parallelize well across instances. Adding CPU, memory, or input and output capacity to that instance can be the simplest short term move. I would scale horizontally when requests are easy to distribute, state is externalized, I need a higher scaling ceiling, or I need better failover. I would retest with the same representative load and confirm that the bottleneck did not simply move somewhere else.
This question asks when it is better to make one running machine stronger instead of adding more machines. I first need to find what is stopping the service from handling more work. If one machine needs more processing power, memory, or storage speed, making it stronger may be the simpler choice. If the work can be divided safely among many machines, adding machines may give more total capacity and better recovery from failure. I also need to consider where important data lives, how quickly added capacity becomes ready, how work is shared, and the total cost.
- Is the service stateful, or is its state stored outside the instance?
- Is the workload made of independent requests or jobs that can run in parallel?
- Which resource is currently closest to saturation under representative load?
- Is the main goal more throughput, better failover, lower cost, or a combination of these?
- How quickly must extra capacity become ready, and do additional instances need startup or warmup time?
I start with measurements instead of choosing vertical or horizontal scaling from intuition. For a service approaching its current throughput limit, I reproduce or observe representative load and record throughput, latency percentiles, errors, and queueing. I then look for the resource that remains saturated as throughput stops increasing. That resource is the current capacity boundary.
I check the same measurement areas shown in the diagram. For CPU, I look at utilization, saturation, and run queue. For memory, I look at utilization, page faults, and garbage collection time when the runtime uses garbage collection. For disk input and output, I look at read and write operations, latency, and queue depth. For the network, I look at throughput, latency, errors, and drops. For the application, I look at requests per second, total throughput, latency percentiles, worker or thread pool pressure, and queue length. For external dependencies, I look at database latency, cache behavior when a cache exists, and downstream errors. I use application metrics, platform metrics, logs, and tracing only as needed to establish which boundary is actually limiting capacity.
Vertical scaling means adding resources to the existing instance. I prefer it when important state is tied to one instance or is difficult to share safely. Examples include an in memory cache, session state, a leader or primary role, a local file index, or a large model held in memory. It is also attractive when the workload has limited parallelism, because adding more instances may not create much useful parallel capacity. The amount of benefit is still limited by the work that can actually use the added resources.
Vertical scaling is operationally simpler because there is still one service instance handling the work and no new load distribution path is required. It can also provide capacity without waiting for an additional instance to register and warm. However, changing the size of an existing instance may require a restart or replacement on some platforms, so I would verify the real startup behavior instead of assuming zero interruption. The main disadvantages are the scaling ceiling and failure concentration. One instance can only grow to the largest practical instance type, and that instance remains an important failure point. I therefore still need backups, snapshots when appropriate, recovery procedures, and a failover plan.
Horizontal scaling means adding more service instances and distributing work among them. It fits best when the service is stateless or its state is externalized, and when requests or jobs can run independently. A load balancer or another distribution mechanism is normally required. I would watch for uneven load and hot spots because adding instances does not help if traffic is not distributed well.
Horizontal scaling usually gives a higher scaling ceiling because more instances can be added as demand grows. It can also improve availability because healthy instances can continue serving traffic when another instance fails. That benefit depends on correct failure detection, routing, shared dependency capacity, and placement across suitable failure domains. New instances also need time to start, register, become ready, and sometimes warm caches or other local state.
Cost depends on the workload and platform. Vertical scaling is often cheaper in the short term because there are fewer moving parts and less operational overhead. Horizontal scaling can become more cost effective at larger scale when the workload is highly parallel, but it adds costs for extra instances, load distribution, connections, shared state, monitoring, and coordination. I would compare total cost at the throughput level I actually need rather than assuming either method is always cheaper.
The final decision follows the measured boundary. If the service is stateful, hard to distribute, or limited by work that does not parallelize well, and the current instance still has useful room to grow, I would usually scale vertically. If the service is stateless, easy to parallelize, needs a higher ceiling, or needs stronger fault tolerance, I would usually scale horizontally. If the service is reaching the practical maximum size of one instance, vertical scaling may only be a short term option before horizontal scaling or redesign becomes necessary.
After the change, I rerun the same representative load. I compare throughput, latency percentiles, error rate, CPU, memory, disk, network, application concurrency, and dependency saturation. I verify that responses and service behavior remain correct. I also check whether the original bottleneck was reduced or simply moved to a database, network path, worker pool, disk path, or another dependency. I continue monitoring the same signals after deployment.
- Define the symptom. Confirm that the service is approaching its throughput limit and record throughput, latency percentiles, errors, and queueing when present.
- Capture a baseline with representative load. Keep the traffic mix, request sizes, data volume, dependency behavior, and warmup conditions consistent.
- Identify the limiting resource. Measure CPU utilization and run queue, memory utilization and pressure, disk input and output operations and latency, network throughput and latency, application concurrency and queue length, and external dependency latency and errors.
- Check statefulness. If important state is tied to one instance and is difficult to share safely, vertical scaling becomes more attractive because it avoids immediate state distribution and coordination.
- Check parallelism. If independent requests or jobs can be distributed and state is stateless or externalized, horizontal scaling becomes more attractive. If the work has limited parallelism, more instances may provide little extra throughput.
- Check the scaling ceiling. If the current instance is already near the largest practical CPU, memory, or input and output capacity, horizontal scaling or redesign may be required. If useful room remains, vertical scaling can be a good short term choice.
- Check failover requirements. A single larger instance concentrates failure impact, while multiple correctly designed instances can provide better availability.
- Check startup behavior. Vertical scaling avoids starting an additional service instance, while horizontal scaling must account for instance startup, registration, readiness, and warmup.
- Check load distribution. Horizontal scaling requires a load balancer or another mechanism that distributes work without creating hot spots.
- Compare total cost. Include compute price, load distribution, extra connections, state coordination, monitoring, and operational work.
- Apply the chosen scaling change and rerun the same representative load.
- Compare the same metrics, verify correctness, and confirm that the capacity boundary improved instead of moving to another resource or dependency.
Vertical scaling is usually simpler to operate because one instance continues to handle the service, but the instance can become expensive and eventually reaches a fixed maximum size. It also concentrates more failure impact in one place. Horizontal scaling adds instances, so it adds startup, warmup, load distribution, connections, shared state, coordination, monitoring, and failure handling. It can provide much more total capacity when the workload can use parallel instances effectively. Representative load testing also consumes compute and dependency capacity, but that measurement cost is necessary because scaling the wrong resource may add expense without increasing throughput.
Interviewers ask this to see whether I measure the real capacity limit before choosing a scaling method. They want to know if I understand how state, parallel work, failover, startup time, traffic distribution, cost, and the maximum size of one instance affect the decision. They also want evidence that I can validate the choice with throughput, latency, errors, and resource saturation instead of assuming that a larger instance or more instances will automatically help.
- Choosing a scaling method before measuring which resource is limiting throughput.
- Looking only at CPU and ignoring memory pressure, disk input and output, network saturation, application concurrency, queues, locks, worker pool pressure, or external dependencies.
- Assuming a stateful service can be copied across instances without dealing with state ownership, consistency, and coordination.
- Assuming more instances always increase throughput when the workload has limited parallelism or a shared dependency is already saturated.
- Assuming a larger instance removes the need for failover, backups, snapshots, and recovery planning.
- Ignoring the fixed maximum size of one instance.
- Ignoring startup, readiness, registration, warmup, load balancing, and hot spots when scaling horizontally.
- Assuming vertical scaling always gives an immediate interruption free change without checking the platform resize behavior.
- Comparing only instance prices instead of total operational and dependency cost.
- Comparing before and after results with different workloads.
- Declaring success without checking correctness and whether the bottleneck moved to another resource or dependency.
Lead with measurement. Explain that you first identify the saturated resource, then connect the scaling choice to statefulness, parallelism, failover, scaling ceiling, startup time, load distribution, and cost. Say that vertical scaling is usually simpler but has a hard ceiling and stronger failure concentration. Say that horizontal scaling provides a higher ceiling and better fault tolerance when the work can be distributed correctly. Finish by saying that you validate the choice with the same representative load and the same metrics.










