Overview of Application Lossless and Transparent (ALT)
Scenarios
When a DB instance undergoes a specification change (at the instance or node level), read replica promotion, or a minor version upgrade, user sessions may be interrupted. In such cases, applications must detect session changes and implement complex recovery measures, such as determining whether database connections or transactions have been interrupted, performing transaction compensation, and rebuilding database session contexts.
To address these issues, TaurusDB provides Application Lossless and Transparent (ALT), which includes read/write ALT and read-only ALT. During database system switchover, ALT prevents database connections and transactions from being interrupted. Applications do not need to perform transaction compensation or restore and rebuild session contexts, thereby ensuring seamless application continuity and uninterrupted workloads.
ALT operates at the user connection level. Users can connect to a database through a database proxy instance. During a specification change, read replica promotion, or minor version upgrade, the system replicates the backend sessions for user connections. Once a safe transaction boundary is reached, the session operation contexts are fully cloned to the target nodes, ensuring uninterrupted workloads.
Basic Concepts
| Concept | Description |
|---|---|
| Secure transaction boundary | The state after the transaction on the current session has been committed and before the next transaction begins. Examples:
|
| Draining | ALT requires that no connection have an ongoing transaction. During a primary/standby switchover, the system must wait for ongoing transactions to complete. The time allowed for transactions to complete is called the draining timeout, which is controlled by the rds_tac_drain_timeout parameter. The default value is 5s, and the valid range is 1–60s. If the workload is heavy, the number of prepared statements is large, or transactions take a long time to execute, you are advised to increase the timeout. Do not reduce it. If some connections still have ongoing transactions when the timeout expires, ALT will not be available for those connections. |
How ALT Works
TaurusDB supports read/write ALT and read-only ALT.
Applications 1 and 2 connect to the database proxy instance through Connection 1 and Connection 2, respectively. The database proxy instance establishes session connections to the primary node and read replicas.
When an instance specification change (excluding specification changes for read replicas), read replica promotion, or minor version upgrade occurs, a switchover between the primary node and a read replica is required. The right side of the architecture diagram shows the state after the switchover:
- Before the switchover: The proxy instance establishes Session X1 and Session X2 connections to the primary node.
- During the switchover: The proxy instance establishes the same number of connections, Session Y1 and Session Y2, to the read replica. The proxy instance then transfers the workloads from the primary node to the read replica.
- After the switchover: The workloads on the original primary node are now running on the new primary node.
Applications 1 and 2 connect to the database proxy instance through Connection 1 and Connection 2, respectively. The database proxy instance establishes session connections to backend read replicas.
When an instance undergoes a specification change (at the instance or node level), a switchover between read replicas is required. The right side of the architecture diagram shows the state after the switchover:
- Before the switchover: The proxy instance establishes Session X1 and Session X2 connections to the old read replica.
- During the switchover: The proxy instance establishes the same number of connections, Session Y1 and Session Y2, to the new read replica. The proxy instance then transfers the workloads from the old read replica to the new read replica.
- After the switchover: Workloads on the old read replica are now running on the new read replica. The old read replica will be deleted after the specification change is complete.
Version Requirements and Constraints
| Feature | Version Requirements |
|---|---|
| Read/Write ALT |
|
| Read-only ALT |
|
Constraints
- The instance must have one primary node and at least one read replica. Database proxy must be enabled, and the instance must be accessed through the database proxy address.
- ALT is not supported in read-only database proxy mode.
- Instance-level ALT is not supported for single-node TaurusDB instances.
- Read-only ALT is not supported for Serverless instances.
- During an ALT switchover, the system temporarily creates the same number of standby connections on the target new primary node as there are connections on the original primary node. Ensure that the maximum total number of connections supported by the DB instance is at least twice the current number of connections. For read-only ALT, when a specification change is performed (at the instance or node level), you must also check the max_connections value for the new specification. Otherwise, the operation may fail with a "Too many connections" error.
Before modifying the maximum number of connections, evaluate the instance specifications and memory usage. For details, see What Is the Maximum Number of Connections to a TaurusDB Instance?
- To use ALT during an instance-level specification change, ensure that the maximum connection limit of the primary node is at least twice the current number of active connections. Before modifying the maximum number of connections, evaluate the instance specifications and memory usage. For details, see What Is the Maximum Number of Connections to a TaurusDB Instance?
Some connections will be retained after the specification change is complete, depending on your configuration of the connection timeout parameter (wait_timeout, which specifies the number of seconds the server waits for activity on a non-interactive connection before closing it).
- ALT supports the Prepare protocol. During a switchover, the context information for prepared statements is rebuilt. If the workload uses a large number of prepared statements, the switchover may be less likely to succeed. Ensure that max_prepared_stmt_count is set to at least twice the number of prepared statements. Before modifying max_prepared_stmt_count, evaluate the instance specifications and memory usage. For details, see Modifying Instance Parameters.
Run the following SQL statement to query the number of prepared statements:
show global status like 'prepared_stmt_count';
- ALT switchovers are recommended during off-peak hours. Excessive workloads on the primary node and read replicas, or multiple specification changes within a short period, may reduce the switchover success rate.
- For details about syntax and function constraints of proxy instances, see Precautions for TaurusDB Proxy Instances.
Unsupported Features
| Module | Description |
|---|---|
| User-defined system variables |
|
| Database proxy |
|
| Temporary tables | User temporary tables are not supported. |
| Secure transaction boundary |
|
| Prepared statement migration |
|
| Other features | Transparent Data Encryption (TDE) cannot be enabled. |
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot