I was just working on mysql master-slave setup for incremental data backup from master to slave. For that I have to enable “bin log” in the master machine. So my doubt is how does master and slave communicate. Is it master which pushes new events to all slaves or slaves keep polling to master for new events?
The Master ‘pushes’ changes to the TCP/IP port at the same time that it writes them to the binlog. The Slave keeps the TCP/IP port open and receives the changes ‘instantly’. It writes them to its “relay log” via the “IO thread”. The “SQL thread” ‘immediately’ sees the change and performs it.
While simple changes happen on the Slave so fast that it is hard to see any delay, there is nothing that guarantees such speed. For example,
UPDATEing all rows of a billion-row table would take hours and delay all replication items after that one statement.