Chapter 8. Load Balancing and High Availability

After you’ve set up replication and have a number of MySQL slaves available to handle your needs, the next problem you’re likely to face is how to route the traffic. For the most part, the problem is quite similar to traditional HTTP load balancing. But since the MySQL protocol isn’t HTTP, there are some important differences that emerge when you get into the nitty-gritty of load balancing MySQL.

The material in this chapter assumes that your MySQL servers are on different machines from your application servers. If you’ve set up a local MySQL slave on each of your web or application servers, there’s no need to worry about MySQL load balancing. Instead, you need a load-balancing solution for the web or application server.

We’ll start with a quick overview of load balancing from both a network and application perspective, and we’ll discuss how load-balancing benefits MySQL deployments. Then we move to some of the issues specific to load balancing MySQL in various configurations, notably health checks and balancing algorithms.

In the limited scope of this book, there’s no way to cover all issues surrounding load balancers and high availability of your systems. For more information on the topic we suggest Tony Bourke’s Server Load Balancing, also published by O’Reilly.

Load Balancing Basics

Typical load-balancing architecture for a read-intensive web site
Figure 8-1. Typical load-balancing architecture for ...

Get High Performance MySQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.