문제

I am discovering the replication possibilities with MySQL, based on the Master and Slave concept.

But I don't find any detailled information about how the threads really work

(even on this website : http://dev.mysql.com/doc/refman/5.0/en/replication-implementation-details.html)

I know there are 3 threads :

  • Slave SQL thread : Execute requests on the slave's Database

  • Slave I/O thread : Connection to the Master, read the binary file and write its requests on the Slave

  • Master Binlog dump thread : Send a copy of the binary file to every I/O Threads connected.

I also know they are following this process :

  1. First the I/O Thread connects to the Master
  2. The Master creates the Binlog dump Thread
  3. The Slave Thread asks the Master Thread in order to get the last version of the binary log
  4. The Master Thread sends it a copy of the binary log
  5. The Slave Thread read the copy, and write its content on the Slave Host (for the Slave SQL Thread, who can execute theses new requests)

That's okay, but what about the behaviour of the I/O Thread after that ? It is still connected on the Master, but what happen if new writing requests are done on the Master Database ? What is the real process ?

I found different possibilities, but I'm not really sure they are the good ones :

  • Slaves that are up to date will mostly be reading events that are still cached in OS cache on the master, so there is not going to be any physical disk reads on the master in order to feed binary log events to slave(s)

So the I/O thread is always looking for new request in the cache ? ...

  • When a new request is written into the binary log file, the Master thread sends it to every I/O threads that are connected.

Does this solution causes problems about overloading, if there are many little writing requests in the same time in the master's Database ?

This is my first post on StackOverflow, I hope my question is understandable.

Thank you in advance ! :)

도움이 되었습니까?

해결책

i think you need the mysql source code to really find out how the process is working. as far as i know the slave waits for the master to send an event.

I cant give you an 100% answer about the overloading. But i never experienced any problems with replicating databases with allot of inserts,updates and deletes.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top