Scaling has become a very important concern and topic in information technology in the age of accelarating technology and data. Can our system handle increased load? How do we make our system, nodes or nodes handle more load or work? How do we manage our resources more efficiently?
The concept of scalability in technology mainly applies to computer systems, databases, computer networks, programs and applications. With web applications its extremely important to understand the number of users it can support and how to scale to allow for increased usage. There are two main solutions to handle scale for such systems, horizontal scaling and vertical scaling.
In image above, vertical scaling enlarges a system as represented by growing vertically, system remains one. Horizontal scaling entails adding additional units of same system e.g more databases or computers as represented by adding more along the horizontal axis.
Horizontal scaling (often referred to as scale out), adds more instances of the system to try and distribute the load equally. For example in client server systems if a single server is overloaded, more servers were traffic can be directed are created. Additionally tools like load balancers are involved to help distribute load equally among the system. For example in distributed computing, more nodes or computers are added.
Horizontal scaling can be likened to producing clones of existing system by duplicating them. In databases via sharding, clones of existing database are spread around multiple servers. Horizontal scaling is less disruptive as existing node can be up, whilst new nodes are added. It may turn out cheaper as even basic machines, nodes or servers working together can have significant efficiency gains. If you reach another load or system strain that requires scaling you can simply add more machins, giving potential for inifinite scaling.
Vertical scaling adds resources or capacity to an existing system. This often includes making hardware improvements like adding more CPU, memory, or storage. For example in a database you may add more physical and virtual resources like adding more storage to handle capacity and load. Vertical scaling can be likened to beefing up the existing system to make it bigger, more powerful and more capable to handle extra requirements and load.
Vertical scaling is often referred to as up/down scaling. Vertical scaling is slower and may disrupt existing operations as the single node or system may be down during upgrade. Hardwware improvements can be expensive and has limitations no matter how good, implying you can only scale horizontally up to a certain limit.
MongoDB is a database that allows you to horizontally scale out across multiple machines. Via sharding the database is split into several parts. Sharding distributes the data across various machines. Examples of other horizontally scaled database include Cassandra and Google Cloud Spanner. Cassandra uses virtual nodes containing data in certain ranges. Google Cloud Spanner is a clustered relational database management system which can easily scale horizontally.
Examples systems not suited to horizontal scaling
Traditional Relational Databases e.g SQL databases like MySQL are normally vertically scaled. Scaling horizontally in databases relies on partitioning data. Paritioning data makes queries and concepts of joins challenging, harms performance and breaks ACID requirements. Relational Databases are inelastic, once you distibute data its difficult or impossible to undistribute it. Other examples vetically scaled databases include Amazon RDS which switches to bigger machines to handle more capacity.
Choosing between vertical and horizontal scaling
The right scaling solution depends on existing systems, your requirements, budget, time constraints,application requirements, infrastracture and technical resources and capabilites. In many systems and databases horizontal scaling seems to be more popular these days due to buzz terms like ability to have elastic systems.