All Products
Search
Document Center

ApsaraDB RDS:Best practices for RTO optimization in AliSQL

Last Updated:Mar 28, 2026

The recovery time objective (RTO) is the maximum time allowed to restore service after a failure. It is a core metric for measuring database high availability. When an RDS instance running AliSQL crashes, every second of recovery delay affects your applications. AliSQL optimizes six stages of the crash recovery pipeline—from tablespace discovery through transaction rollback—so that instances restart faster and become available sooner.

Optimization overview

AliSQL targets six stages of the crash recovery pipeline. Each optimization is independent. Together, they reduce total RTO across the full recovery sequence.

OptimizationRecovery stageImprovement
Massive table startup optimizationTablespace discoveryNormal startup reduced by 73%; crash recovery reduced by >95%; memory usage reduced by >81%
Buffer pool initialization accelerationBuffer pool initializationInitialization time reduced by >80%
Parallel redo log applicationRedo log applicationApplication time reduced by >80%; speed increased by >500%
Fast transaction recoveryTransaction resurrection (undo log scanning)Recovery time for 1-million-record transactions reduced to ~0 s
Asynchronous transaction rollbackUncommitted transaction rollbackRollback time for 1-million-record transactions reduced to ~0 s
Optimization of General Query Log recoveryGeneral Query Log corruption repairRecovery time for a 10 GB log table reduced to ~0 s

Massive table startup optimization

When an RDS instance contains a large number of tables—such as 1 million tables—tablespace checking during startup consumes significant time and memory. The instance must open and verify every tablespace file before it can serve traffic, which means startup time grows linearly with table count. AliSQL optimizes file scanning, data dictionary reading, and table object construction to reduce both startup time and memory usage.

Performance

ScenarioMySQL Community EditionAliSQLImprovement
Normal startup time90.7 s24.1 sReduced by >73%
Crash recovery time521.7 s25 sReduced by >95%
Memory usage during startupHighReduced by >81%

How to enable

RequirementDetails
Minor engine versionMySQL 8.0: 20240731 or later
Key parameterloose_fetch_raw_tablespace_at_startup — enabled by default. When enabled, only necessary metadata is loaded at startup; loading of redundant information is deferred. This reduces both memory usage and startup time.

Buffer pool initialization acceleration

The buffer pool is the core memory structure of InnoDB. When an instance starts after a crash, the buffer pool is empty—all data must be read from disk until the cache warms up. Initializing a large buffer pool takes additional time: memory must be allocated and management structures built. MySQL Community Edition supports parallel initialization, but concurrency bottlenecks in lock structures and global statistics updates limit its effectiveness. AliSQL eliminates these bottlenecks to significantly reduce initialization time.

Performance

ScenarioMySQL Community EditionAliSQLImprovement
Time to initialize a 512 GB buffer pool19.7 s3.8 sReduced by >80%

How to enable

RequirementDetails
Minor engine versionMySQL 8.0: 20220530 or later; MySQL 5.7: 20230531 or later
Key parameterinnodb_buffer_pool_init_optimize — enabled by default. When enabled, the system eliminates lock and synchronization bottlenecks during parallel buffer pool initialization.

Parallel redo log application

Redo logs are the write-ahead logging (WAL) mechanism MySQL uses to ensure data consistency. Redo log scanning and application are the most time-consuming steps in crash recovery. MySQL Community Edition processes them on a single thread using serialized application—recovering 4 GB of redo logs can take several minutes. AliSQL introduces a pipeline mechanism that parallelizes both scanning and application, dramatically improving throughput.

Performance

ScenarioMySQL Community EditionAliSQLImprovement
Time to apply 4 GB of active redo logs118.7 s22.6 sReduced by >80%
Application speedBaselineIncreased by >500%

How to enable

RequirementDetails
Minor engine versionMySQL 8.0: 20241231 or later
Key parameterinnodb_parallel_redo_threads — default value is 1 (disabled). Set to a value greater than 2 (for example, 4) to enable parallel redo log scanning and application.

How to verify

After setting innodb_parallel_redo_threads, confirm that the parameter is active:

SHOW GLOBAL VARIABLES LIKE 'innodb_parallel_redo_threads';

The output should show the value you configured (for example, 4).

Fast transaction recovery

After redo logs are applied, MySQL uses undo logs to recover table locks for active transactions. MySQL Community Edition scans all undo log records row by row to identify which tables each transaction holds locks on. For transactions with millions of records, this scan adds significant delay before the instance can accept connections. AliSQL extends the undo log record structure to enable fast locating and scanning, reducing recovery time to near zero even for large transactions.

Performance

ScenarioMySQL Community EditionAliSQLImprovement
Time to recover a transaction with 1 million records6.8 s~0 sCompletely optimized

How to enable

RequirementDetails
Minor engine versionMySQL 8.0: 20230630 or later; MySQL 5.7: 20230831 or later
Key parameterinnodb_trx_resurrect_table_lock_accelerate — default value is OFF. Set to ON to enable fast undo log scanning for large transaction recovery.

How to verify

After setting innodb_trx_resurrect_table_lock_accelerate, confirm that the parameter is active:

SHOW GLOBAL VARIABLES LIKE 'innodb_trx_resurrect_table_lock_accelerate';

The output should show ON.

Asynchronous transaction rollback

MySQL uses internal XA transactions to keep binary logs and InnoDB consistent. During crash recovery, transactions in the prepared state—where InnoDB completed its prepare phase but the commit was not written to the binary log—must be rolled back. In MySQL Community Edition, this rollback is synchronous: the instance blocks until all rollbacks complete before accepting connections. For large transactions with millions of records, this significantly delays restart. AliSQL moves uncommitted transaction rollback to the background. The instance becomes available immediately after crash recovery, and rollback continues without blocking service.

Performance

ScenarioMySQL Community EditionAliSQLImprovement
Time to roll back a transaction with 1 million records100 s~0 s (instance available immediately)Completely optimized

How to enable

RequirementDetails
Minor engine versionMySQL 8.0: 20220530 or later; MySQL 5.7: 20230531 or later
Key parameterasync_binlog_recovery — enabled by default. When enabled, uncommitted transaction rollback runs in the background so the instance can start accepting requests without waiting for rollback to finish.

Optimization of General Query Log recovery

In TABLE mode, the MySQL General Query Log records user operations in a CSV table. If this table is corrupted at startup, MySQL Community Edition performs a full table scan to locate and rebuild the corrupted data. For a 10 GB log table, this scan takes over four minutes and delays instance availability. AliSQL uses reverse scanning and file truncation to quickly locate and repair the corruption, reducing recovery time to near zero.

Performance

ScenarioMySQL Community EditionAliSQLImprovement
Time to recover a 10 GB General Query Log table270 s~0 sCompletely optimized

How to enable

RequirementDetails
Minor engine versionMySQL 8.0: 20241130 or later; MySQL 5.7: 20241130 or later
Key parameterreverse_repair_general_log_on_boot — enabled by default. When enabled, the system uses reverse scanning and file truncation to accelerate General Query Log table recovery.

Other optimizations

AliSQL also optimizes the process of verifying data in the doublewrite buffer. Update the minor engine version to the latest version to get all available optimizations.