Enable WRITESET to detect transaction conflicts at the row level, improving parallel replay on secondary RDS instances and reducing replication lag.
How WRITESET works
With the default COMMIT_ORDER mode, parallel replay on the secondary instance is limited by commit parallelism on the primary instance.
WRITESET detects conflicts at the row level. Transactions that modify different rows replay in parallel on the secondary instance, regardless of primary instance commit order.
Supported versions
The RDS instance must run one of the following MySQL versions:
|
MySQL version |
Minimum minor engine version |
|
MySQL 5.7 |
20211231 |
|
MySQL 8.0 |
20210930 |
Enable WRITESET
Set these three parameters through Modify instance parameters.
transaction_write_set_extraction = XXHASH64
binlog_transaction_dependency_tracking = WRITESET
binlog_transaction_dependency_history_size = 500000
binlog_transaction_dependency_history_size controls how many rows are tracked in memory for conflict detection. Higher values improve parallelism.
Parameter dependencies
binlog_transaction_dependency_tracking and transaction_write_set_extraction are interdependent. Only the following combinations are valid.
|
binlog_transaction_dependency_tracking |
transaction_write_set_extraction |
|
|
|
|
|
|
Parameter reference
binlog_transaction_dependency_tracking
Controls how binary log transactions are replayed in parallel on the secondary instance.
Multi-threaded parallel replay requires replica_parallel_workers or slave_parallel_workers to be greater than 0.
|
Attribute |
Value |
|
Default |
|
|
Valid values |
|
|
Supported versions |
MySQL 5.7 (minor engine version 20211231 and later), MySQL 8.0 (minor engine version 20210930 and later) |
|
Value |
Description |
|
|
Uses commit order to determine dependencies. Two transactions replay in parallel on the secondary instance only if they commit in parallel on the primary instance. Parallelism is limited by primary instance concurrency. |
|
|
Detects conflicts at the row level. Transactions that modify different rows in tables with a primary or unique key replay in parallel, regardless of primary instance concurrency. |
|
|
Transactions within the same session replay serially. Transactions from different sessions follow the same rules as |
transaction_write_set_extraction
Specifies the hash algorithm for calculating row-level hash values used in conflict detection.
|
Attribute |
Value |
|
Default |
|
|
Valid values |
|
|
Supported versions |
MySQL 5.7 (minor engine version 20211231 and later), MySQL 8.0 (minor engine version 20210930 and later) |
|
Value |
Description |
|
|
Disables row hash calculation. |
|
|
Uses a 64-bit hash algorithm to calculate row hash values. |
binlog_transaction_dependency_history_size
Specifies the maximum number of data rows stored in memory for conflict detection.
|
Attribute |
Value |
|
Recommended value |
|
|
Effect |
A larger value tracks more data rows and enables higher parallelism. |
When WRITESET becomes invalid
In certain scenarios, WRITESET falls back to COMMIT_ORDER. This does not degrade parallel replay performance.
WRITESET becomes invalid when:
-
DDL operations are performed
-
Large transactions are committed
-
Foreign key tables are modified
-
Tables without primary keys exist
Enable WRITESET to reduce replication lag on secondary and read-only instances.
References
-
Use the parameter diagnostics feature for optimization recommendations.
-
MySQL official documentation: