facebook / mysql-5.6

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

ha_rocksdb::external_lock use many CPU time for memory only readonly workload #1201

Open rockeet opened 1 year ago

rockeet commented 1 year ago

It seems myrocks and rocksdb doing many useless works: Clear, Reinitialize:

image image image

In the flame graph, CSPP_WBWI is our WriteBatchWithIndex implementation, used to replace rocksdb default WriteBatchWithIndex.

Although CPU usage of ha_rocksdb::external_lock is 9% of total, it is more than 50% of storage engine layer(except pack/unpack).

We expect ha_external_lock should be light weight for memory only readonly workload, could myrocks add some state variable for checking and skip expensive transaction init works ?

branch: fb-mysql-8.0.28 9cc489f6 test is sysbench oltp_point_select

riversand963 commented 1 year ago

Second graph shows some CPU wasted on DBImpl::ReleaseSnapshot() due to the db mutex, I hope https://github.com/facebook/rocksdb/pull/7516 can help mitigate.