Consistency during replication
Redis Enterprise Software comes with the ability to replicate data to another database instance for high availability and persist in-memory data on disk permanently for durability. With the WAIT command, you can control the consistency and durability guarantees for the replicated and persisted database.
Any updates that are issued to the database are typically performed with the following flow shown below;
- Application issues a write
- Proxy communicates with the correct primary (also known as master) “shard” in the system that contains the given key
- The shard writes the data and sends an acknowledgment to the proxy
- The proxy sends the acknowledgment back to the application
- The write is communicated from master to replica
- Replica acknowledges the write back to the master
- The write to a replica is persisted to disk
- The write is acknowledged within the replica
With the WAIT command, applications can ask to wait for acknowledgments only after replication or persistence is confirmed on the replica. The flow of a write operation with the WAIT command is shown below:
- Application issues a write,
- Proxy communicates with the correct master “shard” in the system that contains the given key,
- Replication communicated the update to the replica shard.
- Replica persists the update to disk (assuming AOF every write setting is selected). 5-8. The acknowledgment is sent back from the replica all the way to the proxy with steps 5 to 8.
With this flow, the application only gets the acknowledgment from the write after durability is achieved with replication to the replica and to the persistent storage.
With the WAIT command, applications can have a guarantee that even under a node failure or node restart, an acknowledged write is recorded.
See the WAIT command for details on the new durability and consistency options.