Book Image

MariaDB High Performance

By : Pierre Mavro
Book Image

MariaDB High Performance

By: Pierre Mavro

Overview of this book

Table of Contents (18 chapters)
MariaDB High Performance
About the Author
About the Reviewers

Load balancing read transactions

Having a single slave to switch it to master in case of problems is a good solution for high availability. However, if you need an intensive read across your database and have already optimized all the things you could do, then the solution is to build additional slaves.

The goal here is to distribute the traffic across multiple slaves for the read access and only write to the MariaDB instance that will then replicate to the slaves. Let's call this the read-only group of MariaDB: read group.

Your application should be able to split by itself the read and write requests. So, we can use DNS round robin for load balance against the read MariaDB instances, as this is the simplest method. However, the danger of that mechanism is that it doesn't detect failure. For example, you've got one write server and two read nodes. If you're running on one read node instead of two, your request will fail at 50 percent.

The solution to avoid this problem is to have a load balancer...