Vertical scaling is a fancy name for upgrading your server specs. Sometimes, we reach a point where the hardware we are running on can't keep up with the workload. This could be hitting CPU limitations, RAM, or storage. But regardless, when this point gets reached, it's time to upgrade!
If you manage your own bare-metal server, this process is tedious but still doable. Upgrading could require either taking your server down to upgrading individual components (say, adding more RAM sticks). It could also involve purchasing a whole new, separate set of computer hardware, setting up and installing all necessary hardware, migrating the database over from the old server to the new server, and then initiating a switchover, having your application code connect to the new one instead of the old one.
Many organizations host databases using cloud-hosted VMs or containers through AWS, GCP, or DigitalOcean. For example, let's say you are renting a virtual server from DigitalOcean with 2 CPUs, eight gigs of RAM, and 256 gigs of storage. When you initially set this up, you created the server (known as droplets in DigitalOcean terminology), manually installed and configured the server, and then started connecting your app server to this. Now that you are reaching capacity limitations, you want to upgrade to 4 CPUs, 16 gigs of RAM, and 512 gigs of storage. To do this, you would spin up a new VM, step through the same configuration you did initially, migrate the data, and then point the app to the new server.
There are also several fully managed services, such as PlanetScale, where scaling vertically can be done with a few clicks of a button. For example, say with PlanetScale, you are currently on a single-core instance type (A PS-320) and want to upgrade to a 2-CPU model. All you have to do is navigate the settings, select the new compute capacity, and upgrade. The upgrade will be executed with zero downtime.
Generally, doubling compute memory and storage resources on platforms like AWS and DigitalOcean doubles your costs. If you are renting specialized hardware, it can be much more than that. This is one of the reasons it is so important to look into other solutions first, like query optimizations, before jumping into spending more money.
To see an example of how vertical scaling can help achieve more scale for your DBMS, skip to 3:50 in the video above. I show a timing comparison between running a workload on a DBMS with three different levels of resources:
- 1 CPU and 512MB of memory
- 2 CPUs and 1G of memory
- 4 CPUs and 2G of memory
As you would expect, with more power comes more performance!
It's important to be aware that in many cases, a doubling of spec only sometimes leads to doubling performance and capacity. How much upgrading a server helps you depends highly on the database size and workload being placed upon it. However, upgrading a server can get you some nice performance gains and provide an easy (though costly) way to grow with demand.