Horizontally vs. Scaling Vertically

Horizontally vs. Scaling Vertically

What Is Scalability?

Scalability describes a system’s elasticity. While we often use it to refer to a system’s ability to grow, it is not exclusive to this definition. We can scale down, scale up, and scale out accordingly.?

If you are running a website, web service, or application, its success hinges on the amount of network traffic it receives. It is common to underestimate just how much traffic your system will incur, especially in the early stages. This could result in a crashed server and/or a decline in your service quality.?

Thus, scalability describes your system’s ability to adapt to change and demand. Good scalability protects you from future downtime and ensures the quality of your service.

What Is Horizontal Scaling?

Horizontal scaling (aka scaling out) refers to adding additional?nodes?or machines to your?infrastructure?to cope with new demands. If you are hosting an application on a server and find that it no longer has the capacity or capabilities to handle traffic, adding a server may be your solution.

You can consider this the opposite of vertical scaling.

What Is Vertical Scaling??

Vertical scaling (aka scaling up) describes adding additional resources to a system so that it meets demand. How is this different from horizontal scaling??

While horizontal scaling refers to adding additional nodes, vertical scaling describes adding more power to your current machines. For instance, if your server requires more processing power, vertical scaling would mean upgrading the CPUs. You can also vertically scale the memory, storage, or network speed.

Additionally, vertical scaling may also describe replacing a server entirely or moving a server’s workload to an upgraded one.?

Horizontal Vs. Vertical Scaling

No alt text provided for this image

Once again, the biggest central functional difference between the two is that horizontal scaling often forces you to rework how you implement your services or layers. For instance, let’s look at simple?three-tier architecture.?

You have your presentation tier (user interface/client), logic tier (virtual server/services), and data tier (storage/databases). In the case of horizontal scaling, you can delegate each tier (or the functions responsible for them) to a different node.?

However, you may already be running these tiers on different servers but find that one of these servers is underperforming or no longer meets demands. Once again, you can choose to scale this server vertically or horizontally. You may upgrade it with more resources or add another server to share the workload.?

For further illustration, let’s consider databases. If you host your database on a single dedicated server and it gets too large, horizontal scaling would mean adding a new node, partitioning, and sharing the data between the old server and the new.

In our “lifting weights” analogy, horizontal scaling would mean buying new clothes while vertical scaling would be modifying your old clothes to handle your new gains.?

With that being said, let’s look at a simple breakdown of the advantages and disadvantages of vertical and horizontal scaling.?

Disadvantages of horizontal scaling

  • Increased complexity of maintenance and operation?- Multiple servers are harder to maintain than a single server is. Additionally, you will need to add software for?load balancing?and possibly?virtualization. Backing up your machines may also become a little more complex. You will need to ensure that nodes synchronize and communicate effectively.?
  • Increased Initial costs?- Adding new servers is far more expensive than upgrading old ones.???

Advantages of vertical scaling

  • Cost-effective?- Upgrading a pre-existing server costs less than purchasing a new one. Additionally, you are less likely to add new backup and virtualization software when scaling vertically. Maintenance costs may potentially remain the same too.
  • Less complex process communication?- When a single node handles all the layers of your services, it will not have to synchronize and communicate with other machines to work. This may result in faster responses.
  • Less complicated maintenance?- Not only is maintenance cheaper but it is less complex because of the number of nodes you will need to manage.?
  • Less need for software changes?- You are less likely to change how the software on a server works or how it is implemented.?????????

Disadvantages of vertical scaling

  • Higher possibility for downtime?- Unless you have a backup server that can handle operations and requests, you will need some considerable downtime to upgrade your machine.?
  • Single point of failure?- Having all your operations on a single server increases the risk of losing all your data if a hardware or software failure was to occur.?
  • Upgrade limitations?- There is a limitation to how much you can upgrade a machine. Every machine has its threshold for RAM, storage, and processing power.?


Advantages of horizontal scaling

  • Scaling is easier from a hardware perspective?- All horizontal scaling requires you to do is add additional machines to your current pool. It eliminates the need to analyze which system specifications you need to upgrade.
  • Fewer periods of downtime?- Because you’re adding a machine, you don’t have to switch the old machine off while scaling. If done effectively, there may never be a need for downtime and clients are less likely to be impacted.
  • Increased resilience and fault tolerance?- Relying on a single node for all your data and operations puts you at a high risk of losing it all when it fails. Distributing it among several nodes saves you from losing it all.?
  • Increased performance?- If you are using horizontal scaling to manage your network traffic, it allows for more endpoints for connections, considering that the load will be delegated among multiple machines.???

Which Should You Choose And When?

Both horizontal and vertical scaling have their own benefits and limitations. Since there isn’t a one-size-fits-all solution for organizations, you need to scale according to your needs and resources. Here are a few factors to consider along with which type of scaling suits the situation best:??

  • Cost?- Initial hardware costs for horizontal upgrades are higher. If you are working on a tight budget and need to add more resources to your infrastructure quickly and cheaply, then vertical scaling may be the best option for you.
  • Future-proofing?- Adding additional updated machines through horizontal scaling will increase the overall performance threshold of your organization. There is a limit to how much you can vertically scale a single node and it may not be able to handle the demands of the future.
  • Topographic distribution?- If you plan to have nationwide or global clients, it is unreasonable to expect them all to access your services from a single machine in a single location. In a situation like this, you’ll need to horizontally scale your resources to maintain your?service level agreement?(SLA).
  • Reliability?- Horizontal scaling may offer you a more reliable system. It increases redundancy and ensures that you are not relying on a single machine. If one machine fails, another may be able to pick up the slack temporarily.?
  • Upgradability and flexibility?- If you are running your application’s tiers on individual machines, they are easier to decouple and upgrade without any downtime.
  • Performance and complexity?- Performance will depend on how your services work and how they are interconnected. Simple straightforward applications won’t benefit much from being run on multiple machines. In fact, it may degrade its quality. Sometimes it’s better to leave the application as is and upgrade the hardware to meet demand. Horizontal scaling may require you to rewrite the code or add a virtual machine that unifies all the servers.??

Manisha Choubey

Aws Devops Engineer | Databricks Consultant | Cloud | Koantek | Terraform | Cloud Formation | Ansible | Jenkins | Docker | Kubernettes |Azure | Databricks | Google Cloud Platform

2 年

Thank you for sharing

要查看或添加评论,请登录

Abhishek Rana的更多文章

社区洞察

其他会员也浏览了