DEV Community

Filipe Costa
Filipe Costa

Posted on

Vertical or Horizontal Scale?

System Design

Horizontal Scaling or Vertical Scaling?

Hi, this is my first article in English, so I apologize for any mistakes. I'm trying to improve my English each day. In this article, I will explain some basic principles of system design for beginners.

Scenario

Imagine that you have built software and an API. Suddenly, you get more and more users, and your application starts experiencing timeouts. You need to increase the capacity of your server.

What is the best way to scale your server?

Vertical Scaling

Vertical scaling involves upgrading a single machine with more resources—such as memory, processor, and disk space—instead of adding more machines.

Horizontal Scaling

Horizontal scaling involves adding more machines to your infrastructure, increasing the number of servers rather than the resources of a single server.

Which is the Best Choice?

It depends on various factors. Below are some good and bad points of each design:

Vertical Scaling

Good Points Bad Points
Consistent data Single point of failure
Single point of process Hardware limits
Small infrastructure (no need for load balancer)

Horizontal Scaling

Good Points Bad Points
Scales well Potential data inconsistency
Resilient Many network calls
Good for increasing users More expensive to maintain
Larger infrastructure

As we can see, there are many good and bad points for each design. Horizontal scaling tends to have more complexity and costs but can handle more users and provide better resilience.

Key questions to consider:

  • Is data consistency very important to you?
  • Can a single point of failure destroy your company?
  • Are your users critical?
  • Does your company have a perspective to increase users?

These considerations can help you choose the best option. Normally, in early stages of a company, vertical scaling is the best way. However, at some point, a single machine might not be enough to support your growth.

Unfortunately, there is no definitive answer to these questions—it depends on your specific situation and moment.

Top comments (0)