Horizontal vs Vertical Scaling
“What would you do if your database server’s disk space becomes full” this question can help you understand the basic difference. If your answer is to add more hard drives then the architecture is vertically scaling. If you can add more database servers then your architecture is horizontally scaling. Vertical scaling is also termed as scaling UP and horizontal as scaling OUT, the following diagram can help visualize it.
As a general rule of thumb there are limitations on adding hardware to increase memory, disk capacity and CPU in a single server. Buying the most powerful CPU in the world will cost way more than multiple ordinary CPUs whose combined power becomes equal in a horizontally scaling architecture. This is a very simplified example just to explain the point. Consider Intel’s top of line processor at the time of writing “E7–2860” 2.26 Ghz with 10 cores, it cost ~17,000$. Roughly the same processing power you can achieve with 5 of Intel Core i7–6600U processors each having 2 cores with clock speed of 2.6 Ghz and stacking 5 of them will cost 400$ x 5 = 2000$. This makes a difference of 15,000$.
Fault tolerance and high availability
If you are relying on a single heavy node, it is not very hard to imagine having a hard time to ensure high availability. In simple terms high availability is a function of number of redundant nodes in a system. A cluster of database servers distributed over multiple data centers is more robust to network outages, environmental hazards and human error etc.
A replicated architecture further means there is no downtime involved when an upgrade is required, which can be a huge relief dealing with critical systems where downtime means loss of revenue.
Trade-offs to consider
Vertical scaling is superior in theory but like every design there are pros and cons of each strategy. A vertically scaling design is much more complex in nature due to factors like
- Network latency
- Network outages
- Synchronization between nodes
- Determining the right node for processing etc.
In past horizontally scaling software solutions have prevailed because of the lack of solutions available which handled a distributed networked architecture gracefully and the problems mentioned above. However things have changed drastically with a lot of big companies realizing the need for vertical scaling solutions and more importantly going open source.
Originally published at pudgylogic.blogspot.com.