I attended the session “Big Transactions on Galera Cluster” Seppo Jaakola from Codership (folks that write Galera).
Huge Transactions are:
- Large read set – no problems
- Large Write Set roughly >10K rows modified can be slow
- Long term transaction – ok but vulnerable for multi-master conflicts
A large transaction can cause flow control to kick in and prevent any transaction to commit before it finishes. This is due to strict ordering of transactions to keep certification working deterministically. Long term transactions are vulnerable to multi master writes. Galera 3 and earlier can use wsrep_max_ws_rows and _size to limit the size of transactions. 2GB is upper limit for transaction size.
If you have a huge transaction be careful killing it because of rollback. You may want to adjust flow control to avoid the other nodes from freezing. Seppo did a demo showing the impact of huge transactions on the cluster. Solutions could be to skip flow control using wsrep_desync. This will fix the master, but slaves will just lag further and further behind. You can also relax the commit order and allow the nodes to be temporarily out of sync (not supported by Galera just an idea).
Streaming replication helps and is added in Galera 4. wsrep_trx_fragment_unit and wsrep_trx_fragement_size are used to configure. This basically divides a huge transaction into a series of smaller transactions that will not interfere with Galera flow control. Seppo set up streaming replication and then reran his demo showing the improvement of the cluster performance. This will allow Galera to break the 2 GB write set limit by breaking up large transactions into smaller chunks. These changes also help Galera to handle hot-spot transactions by setting transaction fragment size to 1 statement.
There are still issues with certification is large and small transactions are being written to multiple nodes, but this appears to be a huge improvement for Galera. I look forward to playing with it in the future. Galera 4 should be out first half of this year. Additional features Non blocking DDL. streaming replication, and optimized consistency alert shutdown (protocol to avoid cluster crash).
One thought on “Big Transactions on Galera Cluster – Percona Live 2015”
[…] Big Transactions on Galera Cluster […]