Instances support and enable parallel replication applier threads, sometimes referred to as a multi-threaded replica. Using multiple replica applier threads in parallel improves the throughput of both the replication applier and incremental recovery.
This means that on instances running 8.0.23 and later, the following system variables must be configured:
-
binlog_transaction_dependency_tracking=WRITESET
NoteThis system variable is deprecated in MySQL 8.0.35 and 8.2.0 and was removed in MySQL 8.4.0. As of MySQL 8.4.0, the server uses the
WRITESET
behavior by default and it is no longer set by MySQL Shell.
By default, the number of applier threads (configured by the
slave_parallel_workers
system
variable) is set to 4.
When you upgrade a cluster that has been running a version of
MySQL server and MySQL Shell earlier than 8.0.23, the instances
are not configured to use the parallel replication applier. If
the parallel applier is not enabled, the output of the
operation shows a message in the
Cluster
.status()instanceErrors
field, for example:
...
"instanceErrors": [
"NOTE: The required parallel-appliers settings are not enabled on
the instance. Use dba.configureInstance() to fix it."
...
In this situation you should reconfigure your instances, so that
they use the parallel replication applier. For each instance
that belongs to the InnoDB Cluster, update the configuration
by issuing dba.configureInstance(instance)
.
Note that usually dba.configureInstance()
is
used before adding the instance to a cluster, but in this
special case there is no need to remove the instance and the
configuration change is made while it is online.
Information about the parallel replication applier is displayed
in the output of the
operation. For example, if the parallel replication applier is
enabled, then the Cluster
.status(extended=1)topology
section output for
the instance shows the number of threads under
applierWorkerThreads
. The system variables
configured for the parallel replication applier are shown in the
output of the
operation.
Cluster
.options()
The server system variable
slave_parallel_workers
(deprecated in MySQL
8.0.30) is removed in 8.3.0 and can not be set or read by
MySQL Shell's applierWorkerThreads
option
for MySQL Server 8.3.0 or higher.
For earlier versions of MySQL Server, the behavior of
MySQL Shell is unchanged and
applierWorkerThreads
is still available.
You can configure the number of threads which an instance uses
for the parallel replication applier with the
applierWorkerThreads
option, which defaults
to 4 threads. The option accepts integers in the range of 0 to
1024 and can only be used with the
dba.configureInstance()
and
dba.configureReplicaSetInstance()
operations.
For example, to use 8 threads, issue:
mysql-js> dba.configureInstance(instance, {applierWorkerThreads: 8, restart: true})
The change to the number of threads used by the parallel replication applier only occurs after the instance is restarted and has rejoined the cluster.
To disable the parallel replication applier, set the
applierWorkerThreads
option to 0.