What is Scaling in Kubernetes?

What is Scaling in Kubernetes?

Understanding the Horizontal and Vertical Scaling

·

4 min read

We all want growth, but we often find ourselves unequipped to deal with it. It’s a bit like going to the gym, lifting weights, and seeing real results, only to realize that you no longer fit into your old clothes.

Now you have to decide if you want to modify them or buy new clothes. I can use this very simple analogy to understand the differences between horizontal and vertical scaling.

In this blog, I am going to cover what exactly horizontal and vertical scaling is, and what is the difference b/w them.

First, you have to know that scaling is one of the challenges of Kubernetes. If you take a look at the DoK Community 2022 report, you will see that among many challenges of managing workloads on Kubernetes, scaling is one of them.

Let's see what is Scalability, what are the types of it and how they are different from each other.

What is Scalability?

Scalability describes a system’s elasticity. While we often use it to refer to a system’s ability to grow but it is not exclusive to this definition.

  • We can scale down, scale up, and scale out accordingly.

  • Performance and scalability are related. An application's success depends on the amount of network traffic it receives. If an application is scaled then it can manage the traffic.

  • It is hard to estimate how much traffic your system will receive, especially in the early stages. It's better to make the application scale up or scale out in order to prevent the application from crashing.

  • If the traffic is not handled properly, this could result in a crashed server and/or a decline in your service quality.

Types of Scaling

  1. Horizontal Scaling

  2. Vertical Scaling

What Is Horizontal Scaling?

Horizontal scaling (also known as 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.

Advantages of Horizontal Scaling

  • 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.
  • 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.

Disadvantages of Horizontal Scaling

  • Increased complexity of maintenance and operation - Multiple servers are harder to maintain than a single server. 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.

What Is Vertical Scaling?

Vertical scaling (also known as scaling up) describes adding additional resources to a system so that it meets demand.

It’s powerful enough to handle a large number of simultaneous requests. However, adding resources can be limited depending on the capabilities of existing servers.

Each server has some kind of storage limitations. Because of that, horizontal scaling is the preferred option in many use cases because it won't prevent you from adding more instances.

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.

Disadvantages of Vertical Scaling

  • 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.

Questions?

There are some questions that you need to answer and that is your homework.

  • Q. 1: Is adding more power only limited to vertical scaling?

  • Q. 2: Is adding more nodes only limited to horizontal scaling?

  • Q. 3: How does scaling affect the data aspects of Kubernetes?

That's it for now. Did you like this blog? Please let me know.

You can follow me on YouTube, Twitter, and LinkedIn also.

Happy Learning!