

Horizontal Vs Vertical Scaling & When Should We Use Either
source link: https://dev.to/bazeng/horizontal-vs-vertical-scaling-when-should-we-use-either-1pk8
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.


Posted on Feb 2
Horizontal Vs Vertical Scaling & When Should We Use Either
Before we dive deeper into this subject. Let's look at how servers work.
We Request the server for a certain resource and in the server we query a database for the specific resource and get a Response. This architecture works fine where we have minimal users but what happens when we have a lot of users. We will find that our server resources don't have enough capacity to handle the increasing number of requests , this calls for an increase in capacity.
We have two options, to scale vertically or horizontally.
Vertical Scaling
Simply put, vertical scaling is when we buy bigger servers. We increase the size of ram, CPUs & memory to one machine.
Horizontal Scaling
In horizontal scaling we increase the number of machines in our servers and distribute requests across the different machines. Here there exists a master-slave architecture where there is a master that has read and write capabilities and there are slaves where data is replicated to. Slaves have read only capability.
The master node serves as the keeper of information. The true data is kept at the master machine, thus writing only occurs there. Reading, on the other hand, is only done in the slave. In case the master node fails , a slave node is chosen as a master while waiting for the master to recover. On recovery the master may be a master node or continue as a slave node.
What is this for?
This architecture serves the purpose of safeguarding site reliability. If a site receives a lot of traffic and the only available database is one master, it will be overloaded with reading and writing requests. Making the entire system slow for everyone on the site.
What are the pros and cons?
For Horizontal scaling, load balancing is required while in Vertical scaling we dont need a load balancer. A load balancer acts as the “traffic cop” sitting in front of your servers and routing client requests across all servers capable of fulfilling those requests in a manner that maximizes speed and capacity utilization and ensures that no one server is overworked
Horizontal Scaling is resilient while Vertical scaling has a single point of failure Case in example if we have a server failure in a vertical scaling setup we lose our server but in a horizontal setup the process are distributed to the other machines.
Horizontal Scaling uses network calls to communicate with different machines while Vertical scaling uses inter-process communication as its one big machine. Communication in A Horizontal setup is slow due to its I/O nature while communication in a vertical setup is much faster.
In Horizontal Scaling data consistency is a challenge as it distributed between different machines while in Vertical scaling its consistent as its one machine.
Horizontal Scaling scales well when users increase while Vertical scaling has hardware limits.
When should you use Horizontal or Vertical scaling ?
Horizontal scaling is preferred when scaling with many users and where resilience is needed. Such that when one server goes down there are other backups.
Vertical scaling is preferred where data consistency is highly needed and the number of users haven't outgrew the current hardware limit
Thanks for reading.Please follow me on twitter @zeelearner
Recommend
-
37
Demo Download Author: squarechip Vi...
-
42
README.md Aquaman
-
29
Horizontal scaling with WebSocket, tutorialAs a developer, you probably know the difference between vertical and horizontal scaling. But if you don’t have much experience with the WebSocket protocol, you might not realize that do...
-
14
TerraPi modular case system for Raspberry Pi supports multiple SSD's, DIN rail, horizontal & vertical mountsTerraPi modular case system for Raspberry Pi supports multiple SSD's, DIN rail, horizontal & vertical mounts
-
12
Add horizontal and vertical reference lines to SAS graphs: The REFLINE statement 0 ...
-
6
Are Vertical or Horizontal Markets the Key to Operator Success? So is Google going vertical? It sure seems like the deal they did with TELUS’ takes t...
-
10
Vertical vs horizontal scalability in software developmentPublished: 2021.09.13 | 1 minutes readScalability is the ability to increase or decrease resources based on demand. There are two types of scalability: vertical and hor...
-
8
AlignedCollectionViewFlowLayout A collection view layout that gives you control over the horizontal and vertical alignment of the cells. You can use it to align the cells like words in a left- or right-aligned text and you can specif...
-
8
Horizontal versus Vertical Rating Scales Jim Lewis, PhD and Jeff Sauro, PhD ...
-
9
React Native Synced Horizontal and Vertical List Features Synced list component for horizontal and vertical navigation between items Written in Typescript Preview: Installa...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK