In the master/slave database replication, all writes go to the master machine. All reads go to the slave machine. The master machine replicates data to the slave. When the master replicates data to the slave, the slave machine has to do a write which would lock up the row. Reading from the slave machine is faster but why?
Answer: Master-Master: This is similar to Master-Slave architecture, the only difference is that both the nodes are masters and replica at the same time i.e. there will be circular replication between the nodes.
And that's where master-slave architecture comes in handy. Basically, master-slave databases involve caching data from the master database to the slave databases. This replication process helps database administrators to replicate copies of the parent database to multiple servers simultaneously.
The Master's session table can be different than the Slave's Session table. The Master can have both newly created sessions and existing sessions that are "refreshed", but the Slave will only have newly created sessions pushed from the Master times a multiplier.
However, all writes must go to the master, because the data flow is one-way from master to slaves, and writing to a slave makes no sense.
The slave should be a lot faster, because:
This all means that the slave is under considerably less load than the master.
Actually, redirecting reads to the slave is a known performance modification.
The Master is very busy
SHOW PROCESSLIST;
with the username system user
). This can slightly slow things down the more Slaves are connected to the Master.Slaves are less busy because it ...
The only exceptions that would put the Slave and the Master on the same level playing field would be
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With