blog

Database as a Service Concepts: Load Balancing

Lukas Vileikis

Published

Load balancing is a very important concept in the world of cloud solutions. Load balancing is especially important when using or choosing to use a Database as a Service (DBaaS) provider – in this blog post we will figure out why.

What is Load Balancing?

In general cloud computing scenarios, load balancing refers to the process of distributing a set of tasks over a set of resources to make their processing more efficient. In more technical terms, load balancing refers to efficiently distributing traffic across a network of servers.

Load balancing is especially important in the age of the cloud where any single server getting overloaded and breaking down in the process isn’t unheard of – load balancers aim to fix this problem.

How are Load Balancers Relevant to Databases?

If you are at least a little familiar with the concept of load balancing, it should be pretty easy to understand how and why it relates to databases. If you’re not very sure though, just know that a database load balancer is a service that stands between applications that run software and databases. The task of the load balancer in that scenario is to distribute the workload across multiple database servers. As far as databases are concerned, a goal of a load balancer is to increase query throughput, minimize latency and maximize resource utilization.

Load balancers usually come with a few load balancing algorithms you can choose from – choose one based on how you would like your traffic to be distributed. Those load balancing algorithms are as follows:

  • The “round robin” balancing algorithm – perhaps the most common load balancing algorithm. When such a load balancing algorithm is in use, a client request is forwarded to each available server in turn.
  • The weight-based balancing algorithm – also a common load balancing algorithm. When such a load balancing algorithm is in use, each database server is assigned a certain “weight” – weight in this scenario refers to the proportion of traffic a server can handle.
  • The least connection-based balancing algorithm – when such a load balancing algorithm is in use, a server with the fewest active of connections is used.

Load Balancers in Database as a Service Solutions

Load balancers are also important in Database as a Service (DBaaS) solutions – if you elect to use a DBaaS solution, load balancers are probably one of your primary concerns. Since most DBaaS offerings enable you to deploy and access managed and secured MariaDB, MySQL and PostgreSQL database clusters, load balancing should come as a no-brainer – especially if you deal with a large number of database instances.

Take, for example, CCX: it provides high availability and failover with multiple availability zones, but it can also provide load balancing, when you choose to deploy, for example, a Percona XtraDB Cluster. This cluster will be deployed together with ProxySQL which provides load balancing capabilities. Simply select it as one of your options when deploying a data store and you’re good to go: 

Selecting Options

Summary

Load balancing is one of the most important concepts in the database world. Load balancing, if done properly, can help distribute workload across multiple database servers and thus, make your life as a developer or a DBA much easier. Load balancing is especially important when choosing a DBaaS provider – give CCX a try today and see what it can offer for your business.

Subscribe below to be notified of fresh posts