views:

247

answers:

1

Currently the slave often falls several thousand seconds behind master,which is a real headache!

A: 

First off, make sure that slave has the same or better hardware configuration compared to the master. The slave has to run the same DML and DDL that is run on the master, plus whatever other load you're throwing at it.

There's plenty of general advice available online on how to optimise mysql performance. The standard suggestion of bumping key_buffer or innodb_buffer_pool (for MyISAM and InnoDB respectively) still applies.

If there's lots of heavy queries running against the slave, consider adding more slaves to spread the load. You should also look at changing the times any cronjobs run at to reduce concurrent queries.