replica_parallel_workers
Applier threads a replica uses to apply transactions in parallel.
- 기본값
4- Range
- 0 to 1024
- Restart needed
- 아니요
- Default checked on
- MySQL 8.4 LTS
기능
Parallel apply follows the commit dependencies recorded by the source. 1 applies transactions one at a time (one coordinator, one worker); 0 also applies them sequentially but is deprecated in 8.4 and raises a warning.
기본값
4. 4 since MySQL 8.0.27 (0 before). Same in 8.4.
Check the current value
SHOW GLOBAL VARIABLES LIKE 'replica_parallel_workers'; SELECT VARIABLE_NAME, VARIABLE_SOURCE, MIN_VALUE, MAX_VALUE, SET_TIME FROM performance_schema.variables_info WHERE VARIABLE_NAME = 'replica_parallel_workers';
Change it
SET GLOBAL replica_parallel_workers = 8; -- until the next restart SET PERSIST replica_parallel_workers = 8; -- now and after restarts
No restart. SET GLOBAL or SET PERSIST takes effect immediately; SET PERSIST also writes mysqld-auto.cnf so the value survives restarts.
When to change it
When a replica lags under a write load the source handles easily. A new value takes effect at the next START REPLICA, so run STOP REPLICA SQL_THREAD; START REPLICA SQL_THREAD; after changing it.
What can go wrong
More threads use more memory and help only when the source's transactions are independent.
Questions about replica_parallel_workers
What is the default value of replica_parallel_workers in MySQL?
4. 4 since MySQL 8.0.27 (0 before). Same in 8.4.
Does changing replica_parallel_workers require a restart?
No. No restart. SET GLOBAL or SET PERSIST takes effect immediately; SET PERSIST also writes mysqld-auto.cnf so the value survives restarts.
When should I change replica_parallel_workers?
When a replica lags under a write load the source handles easily. A new value takes effect at the next START REPLICA, so run STOP REPLICA SQL_THREAD; START REPLICA SQL_THREAD; after changing it.
Back to all MySQL settings, or check the MySQL manual for every option.
Check replica_parallel_workers on your own server
SQLly runs the query above against MySQL and the other engines in this reference, from one desktop app on macOS, Windows and Linux.