Horizontal and Vertical Scaling for Databases

The server is full again, and the purchase request is already open. Horizontal and vertical scaling offer two different ways forward. Which pressure are you trying to remove?

One very tall shelf beside a long row of short shelves in a warehouse

Start With the Limiting Resource

Before asking for more hardware, identify the resource that is full. CPU saturation, memory grant waits, log write latency, and storage capacity have different fixes. A slow query can be wasteful even on an oversized server. Measure the busy period and tie it to the application operation users feel.

I begin with total workload, not the loudest query. A second server will run an inefficient scan just as faithfully as the first. It can even give that scan company. Record throughput, high-percentile response time, waits, and the headroom available during normal peaks.

What Vertical Scaling Buys

Vertical scaling adds resources to one machine or moves the database to a larger VM. More CPU can help concurrent compute work. More memory can retain an active working set. Faster storage can reduce file stalls. The application can usually keep its current connection and data model, which makes this a simpler change than data distribution.

The gain has a ceiling. Hardware and SQL Server edition limits constrain usable cores and memory. Larger machines can cost disproportionately more, and a single busy log remains a shared write path. I verify that the purchased resource is the one the workload actually lacks.

What Horizontal Scaling Buys

Horizontal scaling adds independent capacity. Readable replicas can serve reports. Shards can divide tenant data and writes. A cache can remove repeated reads before they reach SQL Server. Each option changes application routing, data freshness, or operational duties. More nodes do not make one transaction span them cheaply.

I classify requests by whether they can run against a delayed copy or stay within one shard. A read-heavy dashboard is easier to distribute than a transaction updating shared inventory across tenants. The key is finding an honest boundary in the workload, not drawing more boxes on a slide.

Check the Current Server Before Horizontal and Vertical Scaling

Use a short interval of CPU, memory, and file I/O measurements as the baseline. This query shows the resources SQL Server sees and the configured memory ceiling. It does not say which component is the bottleneck. Pair it with wait and query history from the same time window.

Do not compare a quiet morning snapshot with an evening peak. I save timestamps and application volume beside the numbers. A larger machine is worth testing only when the current limit is visible.

SELECT cpu_count, scheduler_count,
       physical_memory_kb / 1024.0 AS host_memory_mb
FROM sys.dm_os_sys_info;

SELECT name, value_in_use
FROM sys.configurations
WHERE name = 'max server memory (MB)';
One bigger server or several smaller ones: a diagram about the horizontal and vertical scaling

Look for Read and Write Separation

If report reads crowd a transactional primary, a readable replica can isolate CPU and storage activity. It also receives and redoes changes, so freshness is not identical to the primary. License, storage, and backup costs follow the replica. Test each report’s read-only behavior and acceptable lag before routing it away.

If writes are the constraint, replicas alone do not distribute them. Sharding or changing the ingestion pattern becomes a deeper design choice. I check batching, indexes, and log latency first. Splitting data to avoid one bad index portfolio is an expensive form of tidying up.

Measure the Cost of Horizontal and Vertical Scaling

Vertical scaling has a hardware or VM cost and, for licensed SQL Server deployments, a possible core-license cost. Horizontal scaling adds nodes plus routing, monitoring, recovery, and deployment work. A fair comparison includes the people who operate it. An extra server is not free because it appears behind a listener.

Estimate growth over a useful horizon and include a failure scenario. A single larger server still needs high availability and restore testing. Several smaller servers need backups and drills for every data location. The cheapest purchase can create the most expensive month of operations.

Test a Larger Machine

Run representative transactions and reports on the proposed CPU, memory, and storage class. Use peak concurrency, not just a single query. Compare throughput and tail latency with the current baseline. Check whether the limiting wait moves from CPU to log or from memory to storage. Moving the bottleneck is useful evidence.

I also verify the SQL Server edition sees the added capacity. This query counts visible online schedulers. A VM can advertise processors that the instance cannot use because of edition or affinity settings.

SELECT COUNT(*) AS visible_online_schedulers,
       SUM(runnable_tasks_count) AS runnable_tasks_now
FROM sys.dm_os_schedulers
WHERE status = 'VISIBLE ONLINE';

Test a Distributed Design

For a replica, measure report latency, primary relief, and data lag. For shards, test a normal tenant query, a cross-tenant report, and a tenant move. For caching, test hit rate, invalidation, and a cold-cache burst. A diagram cannot prove how the design behaves during a partial failure.

I want a clear fallback rule before rollout. If a read replica disappears, do reports pause or overload the primary? If a shard is unavailable, does the application fail that tenant cleanly? These are product decisions as much as database decisions.

Choose the Smallest Useful Step in Horizontal and Vertical Scaling

Fix avoidable query work first. If measured demand still exceeds one practical server, add the capacity at the natural workload boundary. A bigger server can be a sound near-term answer when the application cannot yet route requests. Horizontal scaling earns its complexity when growth or isolation requires independent resources.

Revisit the decision after a full business cycle. Record the baseline, chosen limit, expected gain, and next trigger. Horizontal and vertical scaling are tools, not stages of maturity. The best design is the one your team can measure, recover, and afford.

Before buying capacity, replay a representative read and write mix under controlled conditions. Watch CPU, memory grants, log throughput, waits, and connection counts together. A larger machine can shorten a CPU bound query while leaving a log bottleneck untouched. A second server can absorb reads while adding replication lag and operational work. Put the expected gain and new failure modes on the same page.

I also ask what happens to horizontal and vertical scaling during maintenance. A vertical upgrade usually means moving or resizing one primary service. A distributed design introduces more endpoints and a consistency story. Test failover, backups, and client routing before calling either option simpler. The choice should survive the first planned patch, not just the first performance demo.

Related reading on this blog: How to Prevent Common SQL Server Performance Problems Efficiently With Smart Capacity Planning and Database Sharding: How to Identify a Shard Key?.

Before you buy capacity: a checklist on the horizontal and vertical scaling

Scaling is not a bigger server by default, it is capacity placed at the measured limit.

Published by Pinal Dave on SQLAuthority. More of my work at pinaldave.com.

Database, Hardware, SQL High Availability, SQL Server
Previous Post
Big Data – Buzz Words: What is Hadoop – Day 6 of 21
Next Post
Big Data – Buzz Words: What is MapReduce – Day 7 of 21

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.