[MDEV-18080] Run MyRocks benchmark: MariaDB vs Percona Server vs FB/MySQL Created: 2018-12-25 Updated: 2019-03-28 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - RocksDB |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major |
| Reporter: | Sergei Petrunia | Assignee: | Sergei Petrunia |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
||||||||||||||||
| Issue Links: |
|
||||||||||||||||
| Description |
|
I used AWS c5.2xlarge, 50Gb EBS ssd with 150 IOPs. The scripts to setup servers, sysbench, and run the benchmark are attached. (one only needs to edit my.cnf and start servers) Servers:
Settings that were added to my.cnf:
Percona Server:
Facebook/MySQL 5.6
Sysbench prepare and run commands:
Results: Percona 5.7
MariaDB 10.3
FB/MySQL-5.6
|
| Comments |
| Comment by Sergei Petrunia [ 2018-12-25 ] | |||||||||||||||
|
| |||||||||||||||
| Comment by Sergei Petrunia [ 2018-12-25 ] | |||||||||||||||
|
So, there is some slowdown (starting at 30% and going down as concurrency increases). I'm not sure about the cause. | |||||||||||||||
| Comment by Sergei Petrunia [ 2018-12-26 ] | |||||||||||||||
|
Added current upstream FB/MySQL-5.6 to the chart. | |||||||||||||||
| Comment by Sergei Petrunia [ 2018-12-26 ] | |||||||||||||||
|
Results with log-bin=0: Percona-5.7
MariaDB-10.3
FBMySQL-5.6
| |||||||||||||||
| Comment by Sergei Petrunia [ 2018-12-26 ] | |||||||||||||||
|
This is obviously a bug and should not be happening. | |||||||||||||||
| Comment by Sergei Petrunia [ 2018-12-27 ] | |||||||||||||||
|
Ok, the problem is in non-XA mode. In this mode, rocksdb_prepare and rocksdb_commit_ordered are not called. Only the rocksdb_commit() call is made. In that call, MyRocks is expected to commit the transaction and make its changes persistent. After last fixes (for XA mode), it does it like so:
Looking at DBImpl::FlushWAL() code, I see that it doesn't participate RocksDB's GroupCommit (or, rather GroupFlush). It will attempt to make a flush call, followed by fsync/fdatasync call on its own. This is consistent with the observed performance. (RocksDB's PessimisticTransaction::Commit() will eventually call DBImpl::FlushWAL(). But it will do it inside its group commit implementation, only one call will be made for transactions that are committing concurrently). | |||||||||||||||
| Comment by Sergei Petrunia [ 2018-12-27 ] | |||||||||||||||
|
Trying on a patched version: MariaDB-10.3-patch1
This is on par with other branches. | |||||||||||||||
| Comment by Sergei Petrunia [ 2018-12-28 ] | |||||||||||||||
|
The code that is causing slowdown here was introduced in That MDEV was fixing the performance of multi-threaded slave (non-XA variant of it). The slave wants to make commits in the same order as the master does, the idea was to let the transactions run, but then commit them (call rocksdb_commit) in their order on the master. This caused them to be serialized. The way to un-serialize them was mimicking InnoDB, and it was:
| |||||||||||||||
| Comment by Sergei Petrunia [ 2018-12-28 ] | |||||||||||||||
|
I'm not sure why did this change fix the performance back then but is killing it now. Maybe, something has changed inside RocksDB? (looks like no) | |||||||||||||||
| Comment by Sergei Petrunia [ 2019-03-28 ] | |||||||||||||||
Disable this for non-slave threadsAn obvious thing to do is to disable the new code for non-slave threads (see THD::slave_thread). Possible solutions for slave threads: Hook in RocksDBAdd a hook inside RocksDB somewhere to call thd_wakeup_subsequent_commits(). Non-durable mode for the slave commitsTransactions on the slave come from the binary log, so it is not an issue if (We only need a guarantee that if transaction #N disappears, then all One thing to check: when the slave thinks it has applied all events from Use XA-mode for slave threads.(TODO: this looked like a solution but now I'm trying to describe it and | |||||||||||||||
| Comment by Sergei Petrunia [ 2019-03-28 ] | |||||||||||||||
|
Taking MariaDB 10.2 as a base, cset 0623cc7c16c3280d1f81b9049e1561d1b4b6c1d0. Developed a patch to disable the
|