Mysql – Disk I/O increased when changing RBR to MIXED

MySQLperformancereplication

I'm experiencing some replication issues. I have a Master-Slave replication with mysql; the slave had binlog-format = ROW, Last sunday (3 days ago) I changed the format to MIXED (this is master too; so I expected better performance for his slave). The thing is, it appeared to work fine sunday and monday; but starting tuesday this slave began to lag and kept falling behind for some hours… It catched up around midnight, and today again from nowhere started to lag and kept behind many hours again; trying to understand what's happening I've been asking around and it seems like the workload is the same like past weeks, nothing new that could be causing this behavior. I noticed that the Disk Usage has incremented considerably lately, which is strange, I thought that this change would cause less disk writes…

Disk Usage

I'm attaching the graphic, you can see a lot of reads december 18, that was some Cold Backup, so it's not that…. The question is: Could the change of binlog-format be the cause of this behavior? Is it normal that it is writing a lot more to disk? And is there a way to improve this?

Thanks

Server1:

Master
binlog_format=MIXED

Server2:

Server1's slave
binlog_format=MIXED (This is the one changed, and where the I/O is up).

Server3:

Server2's slave

Best Answer

When a complex UPDATE is run on the master, and it results in only a few rows being updated, then one of these happens:

  • SBR: Re-execute the UPDATE on the Slave. This stalls replication, waiting for the complex query to finish.
  • RBR: Only the changed rows are sent to the Slave. These can be applied much more rapidly.

A simple UPDATE that modifies a million rows:

  • SBR: Again, slow on the slave -- because of all the I/O do update the million rows.
  • RBR: This is also slow, but for a different reason: A million records are sent through the replication stream. This involves I/O at both ends, plus network traffic.

DELETE, INSERT...SELECT, and a few other things have similar characteristics.

I can't be more specific without knowing what, exactly, you were replicating. I hope my examples give you some clues of what could be happening.