MySQL Parallel Replication Strategies

MySQL Version 5.5

  • The official MySQL 5.5 version doesn’t support parallel replication.
  • Table-based Distribution Strategy: If two transactions update different tables, they can be parallelized.
  • Row-based Distribution Strategy: Transactions can be parallelized on the replica if they don’t update the same row.

MySQL Version 5.6

  • Official MySQL 5.6 supports parallel replication but only at the database level.
  • Its efficiency depends on the workload distribution across different databases.

MariaDB’s Parallel Replication Strategy

  1. Transactions that can be committed in the same group on the primary won’t modify the same row.
  2. Transactions that can run in parallel on the primary can also run in parallel on the replica.

MySQL Version 5.7

  • Introduced a strategy controlled by slave-parallel-type:
    1. DATABASE replicates using the MySQL 5.6 database-level strategy.
    2. LOGICAL_CLOCK is a strategy similar to MariaDB’s, but optimized.

MySQL 5.7.22

  • Introduced a new parallel replication strategy based on WRITESET.
  • binlog-transaction-dependency-tracking controls the new strategy.
    1. COMMIT_ORDER: Strategy based on the simultaneous preparation and commit phases.
    2. WRITESET: Strategy based on row hashes. Transactions can be parallelized if their writesets don’t overlap.
    3. WRITESET_SESSION: Similar to WRITESET, but also considers the order of transactions on the primary.