tencent cloud

Database Instance Replication
Last updated:2026-02-05 10:16:19
Database Instance Replication
Last updated: 2026-02-05 10:16:19
Database instance replication refers to data synchronization by configuring one or more backup databases for the server, distributing MySQL data across multiple systems. This document introduces the data replication modes supported by TencentDB for MySQL and the TXSQL kernel's enhancements for data synchronization.
Note:
Primary refers to the master database instance, and Standby refers to the backup database instance.
MySQL versions 5.6, 5.7, and 8.0 support three replication modes: async replication, semi-sync replication, and strong sync replication; version 5.5 supports asynchronous mode.

Data Replication Modes Supported by TencentDB for MySQL

1. Async replication

The application initiates a data update request (including insert, update, and delete operations). The primary node returns a response to the application immediately after performing the update operation; then the primary node replicates data to the standby node.
During data updates, the primary node does not need to wait for the standby node's response. Therefore, database instances with asynchronous replication typically offer higher performance, and the unavailability of the standby node does not affect the primary node's external service provision. However, since data is not synchronized to the standby node in real time, if the primary node fails while the standby node has a delay, there is a small probability of data inconsistency.
TencentDB for MySQL asynchronous replication adopts a one-primary-one-standby architecture.

2. Semi-sync replication

The application initiates a data update request (including insert, update, and delete operations). The primary node replicates data to the standby node immediately after performing the update operation. Only after the standby node receives the data and writes it to the relay log (without execution) does it return a success message to the primary node. The primary node must receive the success message from the standby node before returning a response to the application.
In the event of abnormal data replication (such as standby node unavailability or network abnormalities), the primary node will pause responses to applications (for approximately 10 seconds by MySQL default) and downgrade the replication mode to asynchronous replication. When data replication returns to normal, semi-synchronous replication will be restored.
TencentDB for MySQL semi-synchronous replication adopts a one-primary-one-standby architecture.

3. Strong sync replication

The application initiates a data update request (including insert, update, and delete operations). The primary node replicates data to the standby node immediately after performing the update operation. Only after the standby node receives the data and writes it to the relay log (without execution) does it return a success message to the primary node. The primary node must receive the success message from the standby node before returning a response to the application.
In the event of abnormal data replication (such as standby node unavailability or network abnormalities), the replication mode will not be downgraded. To ensure data consistency, the primary node will pause responses to applications until the abnormality is resolved.
TencentDB for MySQL strong synchronous replication adopts a one-primary-two-standby architecture. It only requires one standby node to succeed in execution before returning, avoiding the issue where a single standby node's unavailability affects operations on the primary node, thus enhancing the availability of the strong synchronous replication cluster.

Optimizations of the TXSQL Kernel for Data Synchronization

Known Issues

Asynchronous, semi-synchronous, and strong synchronous replication methods may cause data inconsistency when the primary node or standby node becomes unavailable.
As the core capability of system data storage and services, the database has very high availability requirements. In production systems, high availability solutions are usually required to ensure uninterrupted operation of the system, and data synchronization technology is the basis of database high availability solutions.

Optimized scheme

The strong synchronous replication solution is a parallel multi-threaded strong synchronous replication solution based on the MySQL protocol independently developed by Tencent. Only after the secondary database data is fully synchronized (logs), a response is returned to the application by the primary database, ensuring data correctness and security.
The principle is illustrated in the diagram below:

When a request is initiated at the application layer, the primary node returns a success response to the application layer only after the standby node returns a success message, ensuring complete data consistency between the primary and standby nodes.
The strong synchronous solution outperforms other mainstream synchronization solutions in performance, with the following key features:
Consistent synchronization replication, ensuring strong consistency of data between nodes.
Completely transparent to the business layer, eliminating the need for the business layer to implement read-write separation or synchronization strengthening.
Asynchronous serialization of synchronization threads, introducing thread pool capabilities to significantly improve performance.
Supports Cloud Disk Edition architecture.
Support for automatic member control, automatically removing faulty nodes from the cluster.
Support for automatic node addition without manual intervention.
Each node contains a complete copy of the data and can be switched at any time.
No need for shared storage devices.
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback