server scaling horizontally and vertically

Almost every business that operates online is trying to plan the traffic demands and to scale their infrastructure accordingly so they can handle every expected and unexpected traffic. Mainly, there are two ways to scale your infrastructure but we will talk about them later in this article. Now, let’s answer the main question:

 

What is scalability and why does my business infrastructure need it?

Scalability, shortly said, is the ability of your infrastructure to continue to function just as fine when it is upgraded or downgraded. The scalability is the number of requests (or visitors) that your servers can process simultaneously before your application stops working. This is the limit. This limit is reached due to resources (CPU, RAM, DISK, etc) running out. Scaling these resources means that you will add more resources to your whole system and your application will continue to work as before. 

 

The most popular ways of scaling are two - Horizontal and Vertical Scaling. Both methods add resources to your whole system but they do it with different approaches. 

 

What is Horizontal scaling?

When scaling horizontally (at some places, it is called “scale-out”), you add more machines to your server’s pool. This means that you will have more servers containing your application and processing requests. The main idea behind this method is that the load is distributed between many servers equally (it depends). Using horizontal scaling, you create a private cloud that you manage entirely - you create and remove the machines and this way you scale your infrastructure. 

 

horizontal scaling infrastructure

 

We recommend using Horizontal scaling and here are some of the advantages of this method:

  • It is easy to scale. Do you need more resources? You just add more servers into the cluster. We assume that you have templates or scripts to automatically deploy everything on the new servers.

  • There is no single point of failure. If one of the machines is out of order, this does not affect your online presence, and your app will be online. Yes, the speed will probably be degraded, but your business will be online.

  • The load is distributed. Let’s say you have 100 web requests to be processed. If you have one server, this means that all of these requests will be handled by one web server, one language processor, one network, and so on. It is always best to distribute this to more than one server because this gives you flexibility, more control, more security, better network performance, and more. 

  • Unlimited scale. You can add an unlimited number of systems (servers) for limitless growth.

  • The process can be completely automated. You can use tools like Terraform, Kubernetes, Docker, Podman, etcetera to automate this process so you do not have to do anything.

 

Here are some of the disadvantages of Horizontal Scaling:

  • The design of your infrastructure will become more complicated. You will start to manage more servers, you should keep them consistent, your application should be made to support horizontal scaling by design, and more. Be prepared to invest time and money when using this type of scaling. 

  • It can become expensive if you are using paid software, which charges you based on the number of servers you have. Let’s say your application works on the Windows Server OS. Every time you deploy a new machine, you have to pay to use this OS too. The amount scales too. 

  • You have to prepare your network too. When using Horizontal scaling, you should have good switches and routers so you can have good connectivity between servers.

  • Initial costs can be higher when implementing Horizontal scaling. To implement such a mechanism, you will bring some complexity to the system which initially will cost you more than using Vertical Scaling. Horizontal scalability becomes much more efficient at a certain point.

 

What is Vertical scaling?

This way of scaling is quite simple - you just upgrade your CPU, RAM, DISK, or whatever resource you need. Here you do not add more machines or anything more complex than just upgrading your current hardware or VPS

 

vertical scaling

 

Of course, because of its simplicity, this method of scaling comes with advantages, some of them are:

  • No complex syncing. Data consistency. The data is stored in one place and you should not worry about syncing it with other servers.

  • The communication between services is faster. Let’s say you have a website. The web server communicates locally with the language interpreter which will be always faster than using the network. 

  • It could be less expensive in the beginning. If you just begin to think about scaling, scaling up is a solution for you, because it would be cheaper to a certain point. If you use a paid software, you pay for only the license and the maintenance cost is lower.

  • Your application is probably ready for this kind of scaling. To use Horizontal scaling requires your app to deal with problems which we will describe in another article, but this is not valid for Vertical scaling. Probably you can scale right now, without any concerns about the app.

 

The Vertical scaling is simple but limited:

  • You can not scale up forever. At some point, the resources will reach their limit and you won’t be able to scale more. This is the moment when you realize you need horizontal scaling. 

  • Single point of failure. If the hosting machine experiences some issues, your business is offline. Because one server hosts everything.

  • Resource upgrade = (almost) guaranteed downtime. If you use a hardware machine, in order to upgrade it, you will need to power it off first and then upgrade it. This is not valid when you are using a virtual private server or VDS. The upgrade with some virtualization software can be applied without even a reboot.
    Did you know that our OpenVZ VPS can be upgraded without even a reboot?

  • Busy network and services. On this server, you will have one service to process the requests (for example, a web server), one network, and all of the load will be handled by one server. 

 

What scaling to choose for my application?

It is hard to say which mechanism will work best for you because it depends on many factors that you should consider:

  • Redundancy. If this is important for you, you should go with horizontal scaling.

  • Cost. Of course, this is important, but in some cases the vertical scaling is less expensive.

  • Geographical distribution. If you want to go worldwide, you definitely should be using horizontal scaling.

  • Does your app allow horizontal scaling? Your application can be designed just for scaling up. This way you are locked to this mechanism. Your developers should do some additional work to make it work on horizontal scaling.

 

You should be consulted by an expert on this question because this is very important for your business. There is a tendency to apply horizontal scaling and this trend is driven by the demand of reliable applications. Sometimes you can use both methods to scale your infrastructure and there is nothing wrong with this.

 

When to start thinking about scaling?

Usually, the question of scaling would arise when the design of your application is planned. The application should be made to support one of the above-mentioned scaling mechanisms. Also, it is very important that you make projections on how many users you will have in 6 or 12 months so you can plan accordingly. 

 

If you already have an up and running online business, you should start watching the metrics of your server (CPU, I/O, DISK, RAM, etc). When you determine which resource is running out and this usage is legit, you can start thinking about how to scale, vertically or horizontally.

 

We believe that we have covered the biggest moments of these two scaling mechanisms. In our next articles, we will be talking about the problems at a software level when scaling horizontally and how to resolve them. Also, we will show you how to configure your first horizontally scaling infrastructure. Stay tuned!

Choose your service now with instant activation.

Get started with no risk - we offer 30-day moneyback guarantee.

Get started