rocksdb/cache
Bo Wang f706a9c199 Add a secondary cache implementation based on LRUCache 1 (#9518)
Summary:
**Summary:**
RocksDB uses a block cache to reduce IO and make queries more efficient. The block cache is based on the LRU algorithm (LRUCache) and keeps objects containing uncompressed data, such as Block, ParsedFullFilterBlock etc. It allows the user to configure a second level cache (rocksdb::SecondaryCache) to extend the primary block cache by holding items evicted from it. Some of the major RocksDB users, like MyRocks, use direct IO and would like to use a primary block cache for uncompressed data and a secondary cache for compressed data. The latter allows us to mitigate the loss of the Linux page cache due to direct IO.

This PR includes a concrete implementation of rocksdb::SecondaryCache that integrates with compression libraries such as LZ4 and implements an LRU cache to hold compressed blocks.

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

Test Plan:
In this PR, the lru_secondary_cache_test.cc includes the following tests:
1. The unit tests for the secondary cache with either compression or no compression, such as basic tests, fails tests.
2. The integration tests with both primary cache and this secondary cache .

**Follow Up:**

1. Statistics (e.g. compression ratio) will be added in another PR.
2. Once this implementation is ready, I will do some shadow testing and benchmarking with UDB to measure the impact.

Reviewed By: anand1976

Differential Revision: D34430930

Pulled By: gitbw95

fbshipit-source-id: 218d78b672a2f914856d8a90ff32f2f5b5043ded
2022-02-23 16:06:27 -08:00
..
cache_bench_tool.cc Change type of cache buffer passed to Cache::CreateCallback() to const void* (#9595) 2022-02-17 21:09:56 -08: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 Bloom/Ribbon filter construction memory in global memory limit (#9073) 2021-11-18 09:42:20 -08:00
cache_entry_roles.h Account Bloom/Ribbon filter construction memory in global memory limit (#9073) 2021-11-18 09:42:20 -08:00
cache_entry_stats.h New stable, fixed-length cache keys (#9126) 2021-12-16 17:15:13 -08:00
cache_helpers.h Use deleters to label cache entries and collect stats (#8297) 2021-05-19 16:51:13 -07:00
cache_key.cc Enhance new cache key testing & comments (#9329) 2022-02-04 14:15:58 -08:00
cache_key.h New stable, fixed-length cache keys (#9126) 2021-12-16 17:15:13 -08:00
cache_reservation_manager_test.cc New stable, fixed-length cache keys (#9126) 2021-12-16 17:15:13 -08:00
cache_reservation_manager.cc New stable, fixed-length cache keys (#9126) 2021-12-16 17:15:13 -08:00
cache_reservation_manager.h New stable, fixed-length cache keys (#9126) 2021-12-16 17:15:13 -08:00
cache_test.cc Fix/improve 'must free heap allocations' code (#9209) 2021-11-29 10:53:52 -08:00
cache.cc Make SecondaryCache Customizable (#8480) 2021-07-06 09:18:08 -07:00
clock_cache.cc Fix unity build with SUPPORT_CLOCK_CACHE (#9309) 2021-12-17 14:15:07 -08:00
clock_cache.h Change RocksDB License 2017-07-15 16:11:23 -07:00
lru_cache_test.cc Change type of cache buffer passed to Cache::CreateCallback() to const void* (#9595) 2022-02-17 21:09:56 -08:00
lru_cache.cc Fix/improve 'must free heap allocations' code (#9209) 2021-11-29 10:53:52 -08:00
lru_cache.h Add a stat to count secondary cache hits (#8666) 2021-08-16 21:01:14 -07:00
lru_secondary_cache_test.cc Add a secondary cache implementation based on LRUCache 1 (#9518) 2022-02-23 16:06:27 -08:00
lru_secondary_cache.cc Add a secondary cache implementation based on LRUCache 1 (#9518) 2022-02-23 16:06:27 -08:00
lru_secondary_cache.h Add a secondary cache implementation based on LRUCache 1 (#9518) 2022-02-23 16:06:27 -08: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