[Maria-developers] MariaDB parallel replication

Some interesting work is starting to be done by users to test parallel replication on real workloads. One issue that comes up is the performance on workloads that have a relatively high number of lock conflicts between transactions. I made some patches (against latest 10.1) to help investigate and improve the issues, and I wanted to mention them here in case someone wants to comment on or experiment with them: 1. Adding status variables for parallel replication. http://lists.askmonty.org/pipermail/commits/2015-July/008131.html This patch adds new status variables that measure the time spent by parallel replication worker threads being - Idle (waiting for work from the SQL thread). - Processing relay log events. - Waiting for a prior group commit to finish (measuring the overhead of insufficient parallelism recorded on the master, in conservative mode, or the overhead of serialisation around DDL, in optimistic/aggressive modes). - Waiting for the immediately prior transaction to commit (measuring the overhead of in-order parallel replication). - Rolling back and re-executing events due to deadlocks. It would be interesting to see how the different numbers compare on various workloads and parallel replication modes. 2. More aggressive retry of conflicting transactions. http://lists.askmonty.org/pipermail/commits/2015-July/008133.html When we get a deadlock and a transaction retry, the current MariaDB waits for all prior transactions to commit before retrying. The logic is that since we already got a conflict, there is a high risk that an immediate retry will just give another conflict. So if we have T1 T2 T3 T4, and T4 conflicts with T1, we roll back T4, wait for T3 to commit, and only then retry T4. If we have many such conflicts, we could end up wasting a lot of times on such waits. This patch changes aggressive mode so that T4 will only wait for T1 to commit, then it will retry. This allows T4 to run in parallel with T2 and T3. It will be interesting to see if this improves throughput in aggressive mode in some workloads, and also to see if/how much it increases the number of transaction retries and associated overhead. 3. Debug patch to log all row lock waits. http://lists.askmonty.org/pipermail/commits/2015-July/008132.html This is not a patch suitable for production use. It adds an option --gtid-log-all-lock-conflicts. When enabled, whenever one parallel replication transaction needs to wait on the InnoDB row lock of another, it will log a line to the error log, including the GTIDs of the transactions. This could be used to correlate back with the binlog and study exactly which transactions it is that are conflicting with each other. Such results could again be highly interesting. - Kristian.

Kristian Nielsen <knielsen@knielsen-hq.org> writes:
1. Adding status variables for parallel replication.
http://lists.askmonty.org/pipermail/commits/2015-July/008131.html
This patch adds new status variables that measure the time spent by parallel replication worker threads being
After initial tests of the new parallel replication status timers, a bug was found and some useful refinements discovered. I wrote a patch that fixes/improves this: http://lists.askmonty.org/pipermail/commits/2015-July/008165.html First, the code for slave_parallel_wait_prior was incomplete. Some cases of waiting for a prior transaction were incorrectly attributed to slave_parallel_processing, underestimating the cost of enforcing in-order. Second, two extra status variables are introduced to better distinguish different reasons for waiting for a prior transaction. With this patch we have: 1. slave_parallel_wait_prior. This counts time where a transaction was ready to commit, but had to wait for a prior transaction to commit first to enforce correct in-order replication. 2. slave_parallel_wait_retry. This counts the wait that happens when a transaction deadlocks. (In addition to this, the transaction needs to be rolled back and re-tried, these are accounted for in slave_parallel_trx_retry). 3. slave_parallel_wait_dependency. In the optimistic and aggressive modes, this counts waits done for transaction processing that cannot happen in parallel. This includes non-transactional updates (MyISAM) and statement-based replication of temporary tables, which are not safe to optimistically parallelise. It also includes heuristics in optimistic mode that avoids parallel replication of transactions that had row lock waits on the master or that were marked with @@skip_parallel_replication. (It does not include DDL-induced waits, these are accounted as slave_parallel_wait_group in optimistic and aggressive modes). Testing and comments welcomed. I have not been able to do much testing myself of these so far, and mysql-test-run testing is in its nature hard for micro-second status timers. - Kristian.
participants (1)
-
Kristian Nielsen