“performance tuning” (buffer pool sizing, query indexing) is scaling up — a bigger, better-tuned single server. This page is about scaling out: adding replicas so more than one server can serve reads. If you have not yet decided which of those you need, the choice breaks into three independent decisions, and read volume is only one of them. Below is a real source-to-replica setup, GTID-based, with data actually flowing across it and a measured lag.
Table of Contents
Single-server tuning: buffer pool, query cache and indexing
Buffer pool sizing, query cache, and indexing are covered on two other pages: buffer pool and memory tuning (what innodb_buffer_pool_size actually defaults to, and how innodb_dedicated_server computes it) and query optimization (a real EXPLAIN/EXPLAIN ANALYZE before/after an index, and why the MySQL query cache doesn’t exist on any server running 8.0+). That material isn’t repeated here — this page covers what those two don’t: distributing load across more than one server.
Real replication: two throwaway MySQL 8.4.10 instances, one insert, one measured lag
Setup: source (server-id=1) and replica (server-id=2), both scratch datadirs on unique ports, GTID-based auto-positioning — the way MySQL has recommended configuring new replication topologies since 5.6, and simpler than coordinating binlog file/position by hand:
-- on the replica
CHANGE REPLICATION SOURCE TO
SOURCE_HOST='127.0.0.1', SOURCE_PORT=39201,
SOURCE_USER='repl', SOURCE_PASSWORD='...',
SOURCE_AUTO_POSITION=1;
START REPLICA;
SHOW REPLICA STATUS on the replica, unedited:
Replica_IO_Running: Yes
Replica_SQL_Running: Yes
Seconds_Behind_Source: 0
Executed_Gtid_Set: cfae45ee-95f1-11f1-a104-e92b18f68dde:1-4
Then a real write and a real check that it arrived — insert three rows on the source, read them back from the replica, which was never written to directly:
-- on the source
INSERT INTO orders VALUES (1, 99.50), (2, 42.00), (3, 17.25);
-- on the replica, immediately after
SELECT * FROM orders;
+----+-------+
| id | total |
+----+-------+
| 1 | 99.50 |
| 2 | 42.00 |
| 3 | 17.25 |
+----+-------+
How far behind is “asynchronous,” measured
100,000 rows inserted on the source in one statement, then the replica polled every 200ms until its row count matched:
source insert: 0.224s (100,000 rows, one INSERT ... SELECT)
replica caught up after: 0.283s past the source commit
That’s this hardware, this batch size, both instances on localhost with no network latency between them — not a number to quote for your setup. What’s durable is the mechanism: async replication has no bound on that gap. A source failure before a transaction reaches a replica loses that transaction. That’s the actual tradeoff behind the term, not an abstract warning.
Anyone with the MySQL server and client installed can rebuild the pair: mysql-scalability-and-performance-tuning-how-to-guide.sh boots a source and a replica of its own on spare ports, repeats the GTID setup, the three-row insert, the 100,000-row catch-up and the super_read_only rejection, and then shuts both down.
What semisynchronous and Group Replication guarantee instead — cited, not run here
Setting up the semisync plugin or a full Group Replication cluster is more moving parts than this page’s format covers; the two guarantees below are quoted from MySQL’s replication manual rather than demonstrated:
- Semisynchronous: “guarantees that if the source crashes, all the transactions that it has committed have been transmitted to at least one replica” — commit doesn’t return to the client until at least one replica has the data, trading a little commit latency for that guarantee.
- Group Replication: for “a fault-tolerant replication topology where all the servers receive the same transactions in the same order, and a server that crashes can rejoin the group and be brought up to date automatically.”
Read replicas are read-only for a reason
A write sent directly to a replica that also has independent application traffic is how replication topologies get silently inconsistent. Setting super_read_only on a replica turns that into a loud error instead of a silent split:
-- on the replica
SET GLOBAL super_read_only = ON;
INSERT INTO orders VALUES (4, 5.00);
ERROR 1290 (HY000): The MySQL server is running with the --super-read-only option
so it cannot execute this statement
Load balancing across replicas — cited, not run here
No HAProxy setup was verified against a running HAProxy. If you’re routing reads across replicas, HAProxy’s own documentation and the MySQL replication manual are the primary sources; a reverse proxy in front of a replica set only helps once the replicas themselves are healthy and caught up, which is what Seconds_Behind_Source from SHOW REPLICA STATUS tells you per replica.