facebook / mysql-5.6

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

Add rocksdb_block_cache_numshardbits for issue 1336 #1339

Open mdcallag opened 1 year ago

mdcallag commented 1 year ago

This fixes https://github.com/facebook/mysql-5.6/issues/1336

This adds the my.cnf options: rocksdb_block_cache_numshardbits

This option can be set so that RocksDB to fix the number of block cache shards.

The default value is -1 to match existing behavior. When -1 RocksDB code will determine the number of block cache shards as min(6, rocksdb_block_cache_size / min_shard_size) and today min_shard_size is 512K for LRU and 32M for Hyper.

The math above frequently results in a block cache with too many small shards when rocksdb_block_cache_size is not too big (a few GB is not too big) and there will be perf problems that are hard to debug in such a case.

facebook-github-bot commented 1 year ago

@hermanlee has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot commented 1 year ago

@mdcallag has updated the pull request. You must reimport the pull request before landing.

mdcallag commented 1 year ago

It is likely main.mysqld--help-notwin test needs a re-record

Done