Video in progress
What are the benefits of database replication?
Replication means keeping copies of the same data on several servers. If the main server goes down, you can put a replica in its place, and you can split read requests across replicas to take load off the main server.
📖 Answer
Replication solves two problems.
The first is reliability. If the disk of a single database server fails, the data is gone and the service stops. With a replica, you promote it to the new primary (failover) and are back up in a few minutes.
The second is read load. In many systems reads outnumber writes 10 to 100 times. If you send reports, the catalog and search to replicas, the primary is left busy with writes only.
But replication is not a backup. If someone runs DELETE FROM orders by mistake, that command reaches the replicas instantly too. So you need separate backups.
One more subtle point: a replica can lag slightly behind (replication lag). If you read something right after writing it and go to the replica, you might not see it.
Sign up to mark studied questions and save your progress.