rocksdb/cache
Zhichao Cao 699f45049d Introduce a mechanism to dump out blocks from block cache and re-insert to secondary cache (#8912)
Summary:
Background: Cache warming up will cause potential read performance degradation due to reading blocks from storage to the block cache. Since in production, the workload and access pattern to a certain DB is stable, it is a potential solution to dump out the blocks belonging to a certain DB to persist storage (e.g., to a file) and bulk-load the blocks to Secondary cache before the DB is relaunched. For example, when migrating a DB form host A to host B, it will take a short period of time, the access pattern to blocks in the block cache will not change much. It is efficient to dump out the blocks of certain DB, migrate to the destination host and insert them to the Secondary cache before we relaunch the DB.

Design: we introduce the interface of CacheDumpWriter and CacheDumpRead for user to store the blocks dumped out from block cache. RocksDB will encode all the information and send the string to the writer. User can implement their own writer it they want. CacheDumper and CacheLoad are introduced to save the blocks and load the blocks respectively.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/8912

Test Plan: add new tests to lru_cache_test and pass make check.

Reviewed By: pdillinger

Differential Revision: D31452871

Pulled By: zhichao-cao

fbshipit-source-id: 11ab4f5d03e383f476947116361d54188d36ec48
2021-10-07 11:42:31 -07:00
..
cache_bench_tool.cc Make SecondaryCache Customizable (#8480) 2021-07-06 09:18:08 -07:00
cache_bench.cc Add (& fix) some simple source code checks (#8821) 2021-09-07 21:19:27 -07:00
cache_entry_roles.cc Account for dictionary-building buffer in global memory limit (#8428) 2021-09-08 12:35:46 -07:00
cache_entry_roles.h Account for dictionary-building buffer in global memory limit (#8428) 2021-09-08 12:35:46 -07:00
cache_entry_stats.h Fix and detect headers with missing dependencies (#8893) 2021-09-10 10:00:26 -07:00
cache_helpers.h Use deleters to label cache entries and collect stats (#8297) 2021-05-19 16:51:13 -07:00
cache_reservation_manager_test.cc Refactor WriteBufferManager::CacheRep into CacheReservationManager (#8506) 2021-08-24 12:43:31 -07:00
cache_reservation_manager.cc Account for dictionary-building buffer in global memory limit (#8428) 2021-09-08 12:35:46 -07:00
cache_reservation_manager.h Add comment for new_memory_used parameter in CacheReservationManager::UpdateCacheReservation (#8895) 2021-09-09 15:25:24 -07:00
cache_test.cc Use deleters to label cache entries and collect stats (#8297) 2021-05-19 16:51:13 -07:00
cache.cc Make SecondaryCache Customizable (#8480) 2021-07-06 09:18:08 -07:00
clock_cache.cc Replace most typedef with using= (#8751) 2021-09-07 11:31:59 -07:00
clock_cache.h Change RocksDB License 2017-07-15 16:11:23 -07:00
lru_cache_test.cc Introduce a mechanism to dump out blocks from block cache and re-insert to secondary cache (#8912) 2021-10-07 11:42:31 -07:00
lru_cache.cc Fix a race in LRUCacheShard::Promote (#8717) 2021-08-30 19:10:55 -07:00
lru_cache.h Add a stat to count secondary cache hits (#8666) 2021-08-16 21:01:14 -07:00
sharded_cache.cc Add a stat to count secondary cache hits (#8666) 2021-08-16 21:01:14 -07:00
sharded_cache.h Add a stat to count secondary cache hits (#8666) 2021-08-16 21:01:14 -07:00