Quick revision
The short answer
MySQL asynchronous replication commits on the source without waiting, so a failover can lose the last transactions; semi-synchronous replication makes the commit wait until at least one replica acknowledges receiving the events, and with the AFTER_SYNC wait point no other client sees data that could be lost. Group Replication goes further: members agree on every transaction through a Paxos-based group protocol and certify it before it commits, so a majority always has it. Write latency rises in the same order, async, semi-sync, Group Replication, and GTIDs make failover and repointing reliable in all three.
What to remember
In this answer, we saw that asynchronous MySQL replication is fastest but can lose the last transactions on failover, that semi-synchronous replication waits for at least one replica to receive the events and with AFTER_SYNC never exposes data that could be lost, and that Group Replication uses Paxos-based agreement and certification so a majority holds every commit, at the highest latency and with trouble on large transactions. GTIDs make failover reliable in all of them.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
MySQL asynchronous replication commits on the source without waiting, so a failover can lose the last transactions; semi-synchronous replication makes the commit wait until at least one replica acknowledges receiving the events, and with the AFTER_SYNC wait point no other client sees data that could be lost. Group Replication goes further: members agree on every transaction through a Paxos-based group protocol and certify it before it commits, so a majority always has it. Write latency rises in the same order, async, semi-sync, Group Replication, and GTIDs make failover and repointing reliable in all three.
Why this question is asked
MySQL gives us three ways to keep copies of a database, and they differ in exactly the two things we care about during an incident: did we lose data, and how much did every write cost us before the incident. Interviewers ask this because teams often choose a mode by habit, then discover during their first failover that acknowledged orders are gone, or that large batch jobs fail under Group Replication. In this answer, we will recap the binary log and GTIDs, then walk through asynchronous replication, semi-synchronous replication and its wait points, Group Replication with InnoDB Cluster, and compare their latency and failover behaviour.
1A Quick Recap of the Binary Log and GTIDs
MySQL records every committed change in the binary log, the binlog, on the source server (the server that takes writes, formerly called the master). Replicas connect to the source, an I/O thread copies binlog events into a local relay log, and SQL applier threads replay them. Replication is therefore a stream of events from one server to others.
A GTID, a global transaction identifier, is a unique label of the form server_uuid:number given to every transaction, for example 3e11fa47-71ca-11e1-9e33-c80aa9429562:23. With GTIDs switched on, each replica knows exactly which transactions it has applied. That matters at failover: when we promote a replica, every other replica can be pointed at it and ask for just the transactions it is missing, instead of someone working out binlog file names and positions by hand.
So GTIDs do not change durability, but they make every failover safer and faster, whichever replication mode we use.
2Asynchronous Replication: Fast, With a Loss Window
In the default mode, the source commits the transaction, writes it to its binlog and returns success to the client. Replicas fetch the events whenever they get to them. The source never waits, so replication adds nothing to write latency.
But there is a catch. If the source crashes before a replica has copied the latest events, and we promote that replica, those transactions are lost even though clients were told they succeeded. The loss window is the replica's lag, typically milliseconds, but seconds or more during heavy writes.
3Semi-Synchronous Replication and the AFTER_SYNC Wait Point
Semi-synchronous replication is a plugin pair, rpl_semi_sync_source on the source and rpl_semi_sync_replica on replicas in MySQL 8.4, where the old master and slave names were removed. The source waits until a number of replicas, set by rpl_semi_sync_source_wait_for_replica_count (default 1), acknowledge that they have received the events and written them to their relay log. Note that the replica has received them, not necessarily applied them.
Where exactly the source waits is set by rpl_semi_sync_source_wait_point. With AFTER_SYNC, the default, the source writes and syncs the binlog, waits for the acknowledgement, and only then commits in the storage engine. With the older AFTER_COMMIT, it commits in the engine first and waits afterwards. The difference matters: under AFTER_COMMIT, other clients can already read a row that no replica has yet. If the source dies at that moment, those clients saw data that disappears after failover, a so-called phantom read of lost data. AFTER_SYNC prevents this, because nothing is visible until a replica has it.
Notice the timeout. If no replica acknowledges within it, the source silently falls back to asynchronous mode to keep writes flowing. That is good for availability but means the durability promise has quietly lapsed, so we must alert on Rpl_semi_sync_source_status turning OFF. The latency cost is one network round trip per commit.
4Group Replication and InnoDB Cluster
Group Replication works differently. The members, three to nine servers, form a group and use a group communication system based on Paxos, a consensus algorithm, to agree on the order of transactions. When a member commits, it sends the transaction's write set (the rows it changed) to the group. Once a majority has received it in the agreed order, every member runs certification, a deterministic check that no concurrent transaction changed the same rows. If certification passes, the transaction commits; if not, it is rolled back.
Single-primary mode, where one member accepts writes and the others are read-only, is the usual choice, because it avoids certification conflicts between concurrent writers. If the primary fails, the group elects a new one automatically. InnoDB Cluster packages this with MySQL Shell for administration and MySQL Router, a lightweight proxy that sends application connections to the current primary.
Because a majority must receive each transaction before it commits, a single failure never loses an acknowledged commit. Secondaries may still apply it slightly later, so reads on them can be stale; the group_replication_consistency setting controls whether reads or writes wait for that (check your version's default).
5Comparing Durability and Latency
Latency grows from left to right in the table below. Asynchronous adds nothing. Semi-sync adds one round trip to the fastest acknowledging replica. Group Replication adds a consensus round to a majority plus certification, and it suffers most from large transactions: the whole write set is sent as one message, so a transaction changing millions of rows can be slow or exceed group_replication_transaction_size_limit and be rolled back. Batch jobs should therefore commit in chunks of, say, a few thousand rows.
| Mode | Commit waits for | Loss on failover | Write latency |
|---|---|---|---|
| Asynchronous | Source only | Possible, up to lag | Lowest |
Semi-sync AFTER_SYNC | 1+ replica received events | None unless it fell back to async | +1 round trip |
| Group Replication | Majority agrees, then certify | None for one failure | Highest, worst for big transactions |
6Follow-up questions
Why is AFTER_SYNC safer than AFTER_COMMIT?
With AFTER_COMMIT, the transaction becomes visible to other sessions before any replica has acknowledged it. If the source crashes then, other users may have read and acted on data that does not exist after failover. AFTER_SYNC makes the source wait for the acknowledgement before committing in the storage engine, so nothing is visible that a replica does not already have.
Can Group Replication run in multi-primary mode?
Yes, every member can accept writes, but concurrent changes to the same rows on different members fail certification and roll back, and some features such as certain foreign key and isolation combinations are restricted. Most teams use single-primary mode and scale reads with secondaries or extra asynchronous replicas.
How do you fail over an asynchronous setup safely?
Pick the replica with the most transactions applied by comparing gtid_executed, promote it, and point other replicas at it with SOURCE_AUTO_POSITION = 1. Tools such as Orchestrator automate this. We should also fence the old source so it cannot take writes if it comes back.
7Conclusion
In this answer, we saw that asynchronous MySQL replication is fastest but can lose the last transactions on failover, that semi-synchronous replication waits for at least one replica to receive the events and with AFTER_SYNC never exposes data that could be lost, and that Group Replication uses Paxos-based agreement and certification so a majority holds every commit, at the highest latency and with trouble on large transactions. GTIDs make failover reliable in all of them.
Open with
MySQL gives three options. Plain asynchronous replication commits on the source and returns; replicas read the binlog later. It adds no latency but if the source dies, transactions not yet copied are lost after failover.
Then, if they want more
Semi-synchronous replication, in 8.4 the rpl_semi_sync_source and replica plugins, makes the commit wait until rpl_semi_sync_source_wait_for_replica_count replicas, usually one, have received the events into their relay log. That costs one round trip per commit.
The wait point matters: AFTER_SYNC, the default, waits before committing in InnoDB, so other clients never see data that could vanish after failover, while AFTER_COMMIT can show them a phantom row. I would also alert when semi-sync falls back to async after its timeout.
Group Replication is a different model: members use a Paxos-based protocol to agree on transaction order, a majority must receive each write set, and each member certifies it for conflicts before commit. So one member failure never loses an acknowledged commit, and the group elects a new primary itself.
Single-primary mode is the norm, and InnoDB Cluster adds MySQL Shell and MySQL Router. It has the highest latency and big transactions hurt, so batch work should be chunked. In all modes I would enable GTIDs, because they make promoting a replica and repointing the others reliable.
About this answer
- Last updated
- 12 November 2026
- Versions it names
- MySQL 8.4
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- PostgreSQL documentation, MySQL reference manual
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Compare MySQL 8.4 asynchronous replication, semi-synchronous replication and Group...": https://scrivio-interview-library.netlify.app/databases/replication-and-ha/7af9059731/