MySQL – Limits on Number of Slaves per Master

MySQLmysql-5.5replication

I currently have a Master with 2 slaves, all running MySql 5.5.

What are the limitations on the amount of slaves I can connect to a single master? what parameters should be taken into affect?

Best Answer

There are no limits in terms of settings, but you need to be cognizant of some aspects.

You could use semisynchrnous replication as it uses a nice algorithm for shipping SQL to Slaves by making sure at least one server has all the latest SQL in the Slaves relay logs. (See my August 5, 2011 post Is MySQL Replication Affected by a High-Latency Interconnect?)

However, semisynchronous replication is only good for one out of N Slaves.

Whether you have semisynchronous replication or not, it would suffice to say that the more Slaves you have, the more CPU processing a Master has to do to keep its Slaves up-to-date.

For a Master with N Slaves, that's...

  • N SQL Statements to send to Slave
  • N Acknowledgments from Slaves 1-N that SQL was Executed

With semisynchrnous replication, it is not much better because For a Master with N Slaves, that's ...

  • N SQL Statements to send to Slave
  • Acknowledgments from Slave
    • 1 Acknowledgment that a Slave 1 received the latest SQL
    • N-1 Acknowledgments from Slaves 2-N that SQL was Executed

If you have to have many Slaves, think of using a Distribution Master in a Star Topology

If you cannot setup a Distribution Master in a Star Topology, then here is my simple rule: Use Semisynchrnous Replication but use as few Slaves as possible.