Most of the enterprise applications have “Built to Scale” as one of the features. The ability of an application to scale is what all enterprises desire as it allows a larger amount of people to be on-boarded on to the platform and get them to start using the application. Without scalability, a lot of issues in performance, disruption of service, and loss of users might occur. All of these would directly impact the revenues of the company and that is the primary reason why scalability is of utmost importance.
The scalability of a database determines how well the application can scale. But, what is Database Scalability and how can we make a database scalable?
Let’s answer these questions. To begin with, Scalability is the ability to handle increased workloads without compromising significant performance. In this sense, scalability would mean that a database can withstand an increasing amount of requests from the application to store, modify, and retrieve data. It can also mean that the database can scale as and when the request load arises and they can serve each of the requests without dropping any.
Types of Database Scalability
Database Scalability has two dimensions to it. Vertical Scalability, and Horizontal Scalability. Let’s look at each of these in more detail.
Scaling a database up refers to the process of adding or removing hardware resources from an existing server. Physical resources such as CPUs, memory ( RAM), storage capacity ( HDD/ SSD) can be added to ensure that the database scales effortlessly when high volumes of requests are sent to the database servers. Resources which aren’t utilized can be removed from the server and this is called scaling down.
This approach allows expansion of the server’s capability as and when the need arises and that means that the initial investment need not be high to procure the hardware components. RDBMS such as MySQL databases are known to use Vertical Scaling. With the advancement of cloud technology, the scaling up and down can be done based on anticipated or real-time load.
However, vertical scaling comes with its set of disadvantages. Firstly, scaling up has a limit set by the server. For example, the type of CPU that can be added or the fact that a server will be able to accommodate only a certain amount of RAM. These limits can drive the price up of hardware as it would require the organization to procure larger servers themselves rather than just the components.
Secondly, these scaling would require the database to be brought down for the time for which the scaling needs to happen. This leads to the disruption of service that the application provides, a feature which isn’t desirable most of the time.
Horizontal scaling refers to replicating the existing hardware rather than just resources like in the case of vertical scaling. His type of scalability involves having multiple hardware components working together as one. As you might have figured out, to horizontally scale a database, one can continuously add more servers and accommodate more data volume.
The major advantages with horizontal scaling are that the initial cost of setup is low and scaling can be carried out only when required. It also allows for multiple ways to carry out scalability.
- Data Replication – This concept involves replicating the entire database on multiple servers. This way, servers can be placed at multiple geographic locations and it would allow to faster service to that geographical location.
- Sharding – This refers to the process of utilizing software on a distributed network to keep parts of data on each machine. Here, every server will hold and perform an action on the part of the data it stores. All the servers work together to act as a single database. Sharding is not simple as it requires the implementation of various strategies that determines that database performance.
Does horizontal database scalability have any disadvantages?
Yes. they do. To start with, sometimes, very specific software that runs on distributed networks are needed to scale. Secondly, there may be times where the performance in a certain geographical location might be sub-par based on the decisions taken while placing the servers.
What to chose?
We saw that both Vertical and Horizontal Database Scalabilities offer effective scaling options and they also come with their set of disadvantages. So, how do we choose the one that best works for an enterprise application?
Unfortunately, the answer is not linear. There are a lot of parameters from Business Goals to user demographics that need to be considered while deciding the type of scalability that your application should implement. Most of the times, both Vertical and Horizontal scaling is needed for various operations.
Database Administrators have the necessary training and experience to understand the requirements and other parameters to decide where and how scalability can be applied.
Database PerformanceTechnical Blog Writer - I love Data