Mysql master-slave replication very slow

master-slaveMySQLmysql-replication

We're running a MySQL master-slave replication set-up and the slave is very slow at catching up. There seems to be no high network or cpu usage while the slave is going through the masters' logs. Connection between master and slave is stable and fast (15 MB/s avg.) and the slaves' cpu-usage does not exceed 2 % on every core (quad core cpu).

We've done some testing by letting the slave catch up until its on the same position as the master and then executing a lot of queries. While the masters' cpu-usage goes way up, the slave is actually doing a very poor job at getting the queries from the master. The Relay_Log_Pos is increasing at a very slow tempo and Exec_Master_Log_Pos is very close to the Relay_Log_pos.

To me it seems to be networking related as the Relay_Log_Pos does not increase very fast, causing the slave to not have many queries to execute, or am I missing something here?

Best Answer

45%-96% iowait is quite high.

You'll need to improve your disk write speeds somehow. You could purchase faster disk or upgrade to a RAID controller that has a larger amount of write cache.