rocksdb/db/db_impl
Maysam Yabandeh 638d239507 Charge block cache for cache internal usage (#5797)
Summary:
For our default block cache, each additional entry has extra memory overhead. It include LRUHandle (72 bytes currently) and the cache key (two varint64, file id and offset). The usage is not negligible. For example for block_size=4k, the overhead accounts for an extra 2% memory usage for the cache. The patch charging the cache for the extra usage, reducing untracked memory usage outside block cache. The feature is enabled by default and can be disabled by passing kDontChargeCacheMetadata to the cache constructor.
This PR builds up on https://github.com/facebook/rocksdb/issues/4258
Pull Request resolved: https://github.com/facebook/rocksdb/pull/5797

Test Plan:
- Existing tests are updated to either disable the feature when the test has too much dependency on the old way of accounting the usage or increasing the cache capacity to account for the additional charge of metadata.
- The Usage tests in cache_test.cc are augmented to test the cache usage under kFullChargeCacheMetadata.

Differential Revision: D17396833

Pulled By: maysamyabandeh

fbshipit-source-id: 7684ccb9f8a40ca595e4f5efcdb03623afea0c6f
2019-09-16 15:26:21 -07:00
..
db_impl_compaction_flush.cc replace some reinterpret_cast with static_cast_with_check (#5740) 2019-08-27 10:59:11 -07:00
db_impl_debug.cc Add command "list_file_range_deletes" in ldb (#5615) 2019-08-15 17:01:03 -07:00
db_impl_experimental.cc simplify include directive involving inttypes (#5402) 2019-06-06 13:56:07 -07:00
db_impl_files.cc New API to get all merge operands for a Key (#5604) 2019-08-06 14:26:44 -07:00
db_impl_open.cc Divide file_reader_writer.h and .cc (#5803) 2019-09-16 10:33:51 -07:00
db_impl_readonly.cc Refactor ArenaWrappedDBIter into separate files (#5801) 2019-09-13 13:50:43 -07:00
db_impl_readonly.h Use delete to disable automatic generated methods. (#5009) 2019-09-11 18:09:00 -07:00
db_impl_secondary.cc Refactor ArenaWrappedDBIter into separate files (#5801) 2019-09-13 13:50:43 -07:00
db_impl_secondary.h Override check consistency for DBImplSecondary (#5469) 2019-06-17 15:39:55 -07:00
db_impl_write.cc Add insert hints for each writebatch (#5728) 2019-09-12 17:15:18 -07:00
db_impl.cc Charge block cache for cache internal usage (#5797) 2019-09-16 15:26:21 -07:00
db_impl.h Use delete to disable automatic generated methods. (#5009) 2019-09-11 18:09:00 -07:00
db_secondary_test.cc Fix a bug caused by secondary not skipping the beginning of new MANIFEST (#5472) 2019-06-18 11:21:37 -07:00