Replication is the process of copying and maintaining the same data on multiple servers or nodes so that the system can stay available and responsive even if some components fail. Each copy is called a replica, and replicas can be kept synchronously (tight consistency) or asynchronously (better performance with some delay).
Replication is used to improve availability, performance, and disaster recovery in databases, web applications, and distributed systems.
Why Replication Matters
High availability:
If one server fails, another replica can take over, minimizing downtime.
Load distribution:
Read‑heavy workloads can be spread across replicas, so no single node is overloaded.
Disaster recovery:
Remote replicas act as backups that can restore service after a local failure.
Types of Replication
Synchronous replication:
Writes must be confirmed on all replicas before the transaction is considered complete, giving strong consistency but higher latency.
Asynchronous replication:
Writes are applied to the primary server first, then propagated to replicas shortly afterward, which reduces latency but risks losing some recent data if the primary fails.
Read vs Write Replication
Read replicas:
Used mainly for read queries, offloading the primary server.
Write replicas (multi‑master):
Allow writes on multiple nodes, but coordinating changes becomes more complex and can lead to conflicts.
For beginners, replication is like keeping identical copies of a document on several computers: if one computer crashes, you still have the document on the others. In databases, replicas help keep the system online and fast, even under heavy load or partial failure.
Summary
Replication distributes copies of data across multiple servers to improve availability, read performance, and fault tolerance. It can be synchronous or asynchronous and is often combined with techniques like sharding and load balancing to build scalable, resilient data systems for modern applications.