Let's say that system load consists of 10% writes and 90% reads, and we have determined by
benchmarking that
reads
second with no writes, the average write is twice as slow as the average read, and the relationship is
linear. Suppose that the master and each slave have the same capacity, and that we have one master
and
slaves. Then we have for each server (master or slave):
N
= 1200 - 2 *
reads
writes
= 9 *
/
reads
writes
9 *
/
(N
+ 1) + 2 *
writes
= 1200 / (2 +
9/(N
writes
The last equation indicates the maximum number of writes for
read rate of 1,200 per second and a ratio of nine reads per write.
This analysis yields the following conclusions:
• If
= 0 (which means we have no replication), our system can handle about 1200/11 = 109 writes
N
per second.
• If
= 1, we get up to 184 writes per second.
N
• If
= 8, we get up to 400 writes per second.
N
• If
= 17, we get up to 480 writes per second.
N
• Eventually, as
approaches infinity (and our budget negative infinity), we can get very close to 600
N
writes per second, increasing system throughput about 5.5 times. However, with only eight servers,
we increase it nearly four times.
Note that these computations assume infinite network bandwidth and neglect several other factors that
could be significant on your system. In many cases, you may not be able to perform a computation
similar to the one just shown that accurately predicts what will happen on your system if you add
replication slaves. However, answering the following questions should help you decide whether and by
how much replication will improve the performance of your system:
• What is the read/write ratio on your system?
• How much more write load can one server handle if you reduce the reads?
• For how many slaves do you have bandwidth available on your network?
B.13.9: How can I use replication to provide redundancy or high availability?
How you implement redundancy is entirely dependent on your application and circumstances. High-
availability solutions (with automatic failover) require active monitoring and either custom scripts or third
party tools to provide the failover support from the original MySQL server to the slave.
To handle the process manually, you should be able to switch from a failed master to a pre-configured
slave by altering your application to talk to the new server or by adjusting the DNS for the MySQL
server from the failed server to the new server.
For more information and some example solutions, see
Failover".
B.13.10: How do I tell whether a master server is using statement-based or row-based binary
logging format?
Check the value of the
mysql>
SHOW VARIABLES LIKE 'binlog_format';
MySQL 5.0 FAQ: Replication
is 1200 - 2 * writes. In other words, the system can do 1,200 reads per
(N
+ 1) (reads are split, but writes replicated to all slaves)
= 1200
writes
+ 1))
system variable:
binlog_format
2906
slaves, given a maximum possible
N
Section 16.3.6, "Switching Masters During
N
Need help?
Do you have a question about the 5.0 and is the answer not in the manual?
Questions and answers