By default, Tair (Enterprise Edition) instances use asynchronous replication. Switch to semi-synchronous mode to achieve a Recovery Point Objective (RPO) of 0 during master-replica switchovers — at the cost of increased write latency (typically hundreds of microseconds to several milliseconds).
Prerequisites
Before you begin, ensure that:
-
For DRAM-based instances: the instance is compatible with Redis 6.0 or later and runs minor version 24.8.0.0 or later
-
For ESSD/SSD-based instances: the instance runs minor version 2.5.2 or later
Instances on earlier minor versions do not support changing the synchronization mode. To update, see Upgrade minor and proxy versions.
How it works
Open source Redis uses asynchronous replication: the master node responds to the client immediately after processing a request, then synchronizes data to the replica node in the background. If a master-replica switchover is triggered before the replica catches up, data inconsistency can occur.
In semi-synchronous mode, the master node waits to respond to the client until the replica node has received and acknowledged the replicated logs. This guarantees RPO = 0 — no data is lost during a switchover.
The following diagram shows how both modes work.
When RPO = 0 does not hold
Semi-synchronous mode automatically degrades to asynchronous replication when:
-
The replica node becomes unavailable, or
-
The replication latency between the master and replica nodes exceeds the Degradation Threshold
During degradation, the RPO guarantee is lost. If a master-replica switchover occurs while the instance is in a degraded (asynchronous) state, data written after degradation began may be lost. For example:
-
The replica node becomes slow. Replication latency exceeds the Degradation Threshold.
-
The instance automatically degrades to asynchronous replication. RPO = 0 is no longer guaranteed.
-
A master-replica switchover is triggered (for example, due to a master node failure).
-
Writes that the replica had not yet received are lost.
To reduce this risk, set the Degradation Threshold to a value that matches your latency tolerance. A lower threshold triggers degradation sooner, but also means the instance degrades more readily under transient network conditions.
Change the synchronization mode
-
Log in to the console and go to the Instances page. Select the region where the instance resides, find the instance, and click the instance ID.
-
In the upper-right corner of the Basic Information section, click Change Synchronization Mode.
-
In the panel that appears, configure the following parameters.
Parameter Description Synchronization Mode Default: Asynchronous. Set to Semi-Synchronous to enable synchronous log replication. In semi-synchronous mode, the master node responds to the client only after the replica node acknowledges receipt of the logs. If the replica node is unavailable or communication between nodes is abnormal, the mode automatically degrades to asynchronous replication. Degradation Threshold Available only when Synchronization Mode is set to Semi-Synchronous. Unit: ms. Valid values: 10–60000. Default: 500. When the replication latency between master and replica exceeds this threshold, the synchronization mode automatically changes to Asynchronous. When latency drops back below the threshold, it changes back to Semi-Synchronous. -
Click OK.