facebook / mysql-5.6

Facebook's branch of the Oracle MySQL database. This includes MyRocks.
http://myrocks.io
Other
2.48k stars 712 forks source link

insert is slower when --disable-log-bin is specified #1197

Open rockeet opened 2 years ago

rockeet commented 2 years ago

branch fb-mysql-8.0.23

insert should be faster when --disable-log-bin is specified, but it is slow when --disable-log-bin is specified.

we found this issue when running sysbench:

sysbench --db-driver=mysql --threads=80 --report-interval=1\
                --mysql-host=192.168.31.10 --mysql-port=3306 --mysql-user=test  \
                --mysql-password=1234 --mysql-db=test --tables=80 --table_size=5000000 \
                oltp_read_write --db-ps-mode=disable \
                --mysql_storage_engine=rocksdb prepare
george-lorch commented 2 years ago

This is likely due to the MySQL transaction coordinator. If there are two transaction engines installed and binlog disabled, MySQL uses the TC_LOG_MMAP transaction coordinator, when binlog is enabled the TC_BINLOG coordinator is used. The TC_LOG_MMAP has an inferior group commit algorithm that is not nearly as well optimized or tested as the TC_BINLOG coordinator. Here is an old blog post on TokuDB that explains the issue https://www.percona.com/blog/2016/03/22/tokudb-impacts-innodb-performance/. So if this is in fact what you are running in to, it is a MySQL problem, not a MyRocks problem.

rockeet commented 2 years ago

This is likely due to the MySQL transaction coordinator. If there are two transaction engines installed and binlog disabled, MySQL uses the TC_LOG_MMAP transaction coordinator, when binlog is enabled the TC_BINLOG coordinator is used. The TC_LOG_MMAP has an inferior group commit algorithm that is not nearly as well optimized or tested as the TC_BINLOG coordinator. Here is an old blog post on TokuDB that explains the issue https://www.percona.com/blog/2016/03/22/tokudb-impacts-innodb-performance/. So if this is in fact what you are running in to, it is a MySQL problem, not a MyRocks problem.

It seems this is a rocksdb group commit issue, when we also disable wal, it is faster than enable log-bin!

--rocksdb_write_disable_wal=ON --rocksdb_flush_log_at_trx_commit=0