Skip to main content
Tungsten Replicator

Enabling Parallel Apply During Install

Parallel apply is enabled using the svc-parallelization-type and channels options. The parallelization type defaults to none which is to say that parallel apply is disabled. You should set it to disk. The channels option sets the number of channels (i.e., threads) you propose to use for applying data. Here is a code example of a MySQL Applier installation with parallel apply enabled. The replica will apply transactions using 30 channels.

Example tungsten.ini
[defaults]
install-directory=/opt/continuent
user=tungsten
mysql-allow-intensive-checks=true
profile-script=~/.bash_profile
start-and-report=true

[alpha]
master=sourcehost
members=localhost,sourcehost
datasource-type=mysql
replication-user=tungsten
replication-password=secret
svc-parallelization-type=disk
channels=10
Show argument definitions
user=tungstenOS System User, for example tungsten. DO NOT use root.
profile-script=~/.bash_profileAppend commands to include env.sh in this profile script.

If the installation process fails, check the output of the /tmp/tungsten-configure.log file for more information about the root cause.

There are several additional options that default to reasonable values. You may wish to change them in special cases.

  • buffer-size - Sets the replicator block commit size, which is the number of transactions to commit at once on replicas. Values up to 100 are normally fine.
  • native-slave-takeover - Used to allow Tungsten to take over from native MySQL replication

You can check the number of active channels on a replica by looking at the "channels" property once the replicator restarts.

replica-shell> trepctl -service alpha status| grep channels
channels : 10
important

The channel count for a replica will ALWAYS be 1 because extraction is single-threaded:

primary-shell> trepctl -service alpha status| grep channels
channels : 1
warning

Enabling parallel apply will dramatically increase the number of connections to the database server.

Typically the calculation on a replica would be: Connections = Channel_Count x Service_Count x 2, so for a 4-way Composite Active/Active topology, for example, with 30 channels there would be 30 x 4 x 2 = 240 connections required for the replicator alone, not counting application traffic.

You may display the currently used number of connections in MySQL:

mysql> SHOW STATUS LIKE 'max_used_connections'
+----------------------+-------+
| Variable_name | Value |
+----------------------+-------+
| Max_used_connections | 190 |
+----------------------+-------+
1 row in set (0.00 sec)

Below are suggestions for how to change the maximum connections setting in MySQL both for the running instance as well as at startup:

mysql> SET GLOBAL max_connections = 512;

mysql> SHOW VARIABLES LIKE 'max_connections';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 512 |
+-----------------+-------+
1 row in set (0.00 sec)
shell> vi /etc/my.cnf
max_connections = 512