Which server to be master and which one slave database?

Posted on

Question :

I have an application for which I‌ want to set up a master/slave mysql database, because the current db struggles under high load.

I have two different servers for db replication. Lets call them A and B.
A is the current db server.

Let’s score the CPU power of A as 10 and B as 7.
B has half the memory of A. Both servers run on SSD.

The read/write ratio is about 9 to 1.

Now, my question is which server should be master? and why?

Answer :

In general (until very recent versions), it is better to make the Slave the beefier machine.

Originally, you could easily run queries in parallel on the Master, but they would be run purely sequentially on the Slave. If the system is busy enough, the Slave could get behind. Later versions have changed to RBR and added some parallelism on the Slave.

Also, if the Slave is getting 9 times as many queries (assuming of similar length), then it would be good to have a beefier Slave for that reason.

Leave a Reply

Your email address will not be published. Required fields are marked *