Two questions:

  1. How often does the slave database get updated with changes to the master database?

  2. If I route all non-update queries to my slaves and all update queries to my master, will there be a performance hit as my slaves check to see that their data is up-to-date? Do they even check?!?!

Thanks,

Jean

    • [deleted]

    1. the slaves are in constant contact with the master (what would be the point if the slave contains data that is 5 minutes old?)

    2. Think about what you are asking....

      Vincent,

      Regarding the first question, are you saying that there is no intentional latency in data replication? If so that's great!

      I imagine that there is, in practice, a latency introduced by the fact that replication is still a physical process.

      In particular, I was envisioning that an update may be propagating while the slave is receiving a query. What happens in this case?

      Regarding the second question, I should have been less tongue-in-cheek.

      The root of my question was trying to determine in which direction communication is initiated for replication. From your answer to the first question it appears that the master tells the slaves when an update has occurred.

      To restate the second question (assuming this direction in communication), Is there an associated communications overhead that eventually negates the advantages of spreading non-updating queries slaves databases as the number of slaves increases but the number of update queries remains fairly constant. Again, in practice...

      Thanks,

      Jean

        • [deleted]

        From the manual:
        "Once a slave is properly configured and running, it will simply connect to the master and wait for updates to process"

        As near as I can tell, MySQL's replication is based slaves looking at the logical log of the master. As soon as the master has updated the logical log, the slaves read it and copy the updates.

        "I was envisioning that an update may be propagating while the slave is receiving a query. What happens in this case?"

        I guess with MySQL's rigid locking mechanism, the tables in querstion will be locked during the update. You'd have to give this a whirl on a very large query, see what happens.

        "The root of my question was trying to determine in which direction communication is initiated for replication. From your answer to the first question it appears that the master tells the slaves when an update has occurred"

        Not quite. If you read the manual a bit, it says that the slaves connect to the master, and keep that connection open. They look at the master's binary log. As soon as that changes, the slaves read it and process the changes. So the master is not even aware that there are slaves listening.

        "Is there an associated communications overhead"

        Yes there is, but wether that is a problem depends on your setup.
        You may want to read the replication FAQ:
        http://www.mysql.com/doc/R/e/Replication_FAQ.html

          Write a Reply...