What is Database Replication?

Database replication copies your data across multiple nodes in real time for redundancy and performance. CloudSonic managed databases run on a 3 node replication setup as standard.

CloudSonic
CloudSonic
Last Updated September 10, 2026

TL;DR Database Replication

Database replication is the process of copying data from one database server, called the primary, to one or more additional servers, called replicas, in real time or near real time. The primary purpose is redundancy. If the primary server fails, a replica can take over immediately with minimal data loss. Replication also improves read performance because queries can be distributed across multiple servers rather than all hitting the same one. CloudSonic managed databases run on a 3 node replication setup by default, meaning your data is always maintained across one primary node and two replicas. This is built into every database plan and requires no setup on your part. It works with PostgreSQL, MySQL, MariaDB, and Redis.

How Database Replication Works

Database replication works by having the primary database server record every write operation, meaning every insert, update, or delete, to a log file called the binary log in MySQL and MariaDB or the write-ahead log in PostgreSQL. Replica servers connect to the primary and continuously read this log, applying the same operations to their own copy of the database in the same order. This keeps the replica in sync with the primary with a delay that is typically measured in milliseconds. If the primary server fails, a replica can be promoted to primary and take over with minimal data loss, usually only the transactions that were in flight at the moment of failure. Read queries can also be distributed across replicas to reduce load on the primary, improving performance for read-heavy workloads like most WordPress sites.

Why Database Replication Matters for Your Website

A single database server is a single point of failure. If that server experiences a hardware fault, a software crash, or any other failure, your website loses access to its data and goes offline until the server is recovered. For most websites that downtime is measured in minutes to hours depending on how quickly the failure is detected and how long recovery takes. Database replication eliminates this single point of failure by maintaining up-to-date copies of your data on additional servers at all times. If the primary server fails, a replica can take over within seconds with minimal data loss. Replication also improves performance for read-heavy workloads by distributing queries across multiple servers. For a WordPress site, where the vast majority of database operations are reads rather than writes, this can meaningfully reduce database response times under load. Both benefits, resilience and performance, become more important as your site grows and the cost of downtime increases.

Frequently Asked Questions on Database Replication

Does database replication slow down write operations?

There is a small overhead associated with writing to the binary log or write-ahead log that replication uses, but it is negligible in practice on modern hardware. The performance impact of replication is far outweighed by the availability and redundancy benefits, and for read-heavy workloads like most WordPress sites the ability to distribute reads across replicas actually improves overall database performance.

What happens to data written to the primary between a failure and failover?

Any transactions that were committed on the primary but had not yet been replicated to the replicas at the moment of failure may be lost. This is called replication lag and on a well-configured system with synchronous replication it is measured in milliseconds. CloudSonic's managed database setup is configured to minimise replication lag so the data loss window in a failure scenario is as small as possible.

Can I read from a replica directly to improve performance?

Yes, this is called read scaling and it is one of the performance benefits of replication. Applications can be configured to send read queries to replica servers and write queries to the primary, distributing the total query load across the cluster. For WordPress this typically requires a plugin or custom code to route queries appropriately, but the infrastructure to support it is in place on CloudSonic managed databases.

Is database replication the same as a database backup?

No and this is an important distinction. Replication copies every change to the database in real time, including accidental deletions and data corruption. If you accidentally delete a table on the primary, that deletion is immediately replicated to all replicas. Replication provides redundancy against hardware failure, not against human error or application bugs. Database backups are still essential alongside replication.