Percona XtraDB Cluster Streaming ReplicationPercona XtraDB Cluster 8.0 comes with an upgraded Galera 4.0 library, which provides a new feature – streaming replication. Let’s review what it is and when it might be helpful.

Previous versions of Percona XtraDB Cluster with Galera 3.x had a limitation in how big transactions are handled.

Let’s review the performance under sysbench-tpcc workload when in parallel we update a big update on a table that is even non-related to the tables in the primary workload.

Without Streaming Replication

Let’s run two workloads.

  1. sysbench-tpcc workload with 1 sec resolution
  2. In parallel run UPDATE oltp.sbtest SET k=k+1 LIMIT 1000000

Running update:

Check what is happening in sysbench-tpcc:

The update by itself took *34 sec*.

With this, the main workload stopped for *22 sec*. Basically all queries will be stopped for this long.

With Streaming Replication

How can this be improved with streaming replication?

  1. Let’s enable streaming replication for the session when we will run the update:

Basically, we say that the cluster should split the big transaction into chunks, 1000 rows each, and replicate in these smaller chunks. Other choices for unit beside ‘rows’ are ‘bytes’ or ‘statements’

And run the query:

In sysbench-tpcc:

So what happened here:

The update query took a little longer (39 sec instead of 34 sec). The main workload also took some hit (a decline from 6700 tps to 2210 tps at the worst period), but it did not stop completely, which is a huge improvement.

Why should we not enable streaming by default for all transactions? The reason is it may negatively impact regular small transactions, so it is advisable to use streaming replication only for big or long-running transactions.