Percona Live 2017 Open Source Database Conference

April 24 - 27, 2017

Santa Clara, California

How Avoids and Deals with MySQL/MariaDB Replication Lag

How Avoids and Deals with MySQL/MariaDB Replication Lag

 27 April - 12:50 PM - 1:40 PM @ Ballroom E
Experience level: 
50 minutes conference
Business / Case Studies
Tools and Techniques


MySQL/MariaDB replication is asynchronous. You can make replication faster by using better hardware (faster CPU, more RAM, or quicker disks), or you can use parallel replication to remove it single-threaded limitation; but lag can still happen. This talk is not about making replication faster, it is how to deal with its asynchronous nature, including the (in-)famous lag. We will start by explaining the consequences of asynchronous replication and how/when lag can happen. We will also analyze how some tools, including the pt-osc, try avoiding lag. Then, we will present the solution used at to avoid both creating lag and minimize the consequence of stale reads on slaves (hint: this solution does not mean reading from the master because this does not scale). Once all above is well understood, we will discuss how’s solution can be improved: this solution was designed years ago and we would do this differently if starting from scratch today. Finally, I will present an innovative way to avoid lag: the no-slave-left-behind MariaDB patch.


Eric Herman's picture

Eric Herman

Principal Developer,


Since 2010, Eric has been at addressing various data challenges including scaling usage of MySQL and bringing hadoop into production. Eric spent the prior six years as a developer at MySQL and Sun Microsystems. In his spare time, he contributes to Free Software and develops Open Hardware.

Share this talk