Go to file
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
.circleci
.github/workflows
buckifier configure microbenchmarks, regenerate targets (#9599) 2022-02-22 09:24:51 -08:00
build_tools Enable core dumps in TSAN/UBSAN crash tests (#9616) 2022-02-22 12:23:00 -08:00
cache Add a secondary cache implementation based on LRUCache 1 (#9518) 2022-02-23 16:06:27 -08:00
cmake
coverage
db Support WBWI for keys having timestamps (#9603) 2022-02-22 14:23:01 -08:00
db_stress_tool
docs
env
examples
file
fuzz
include/rocksdb Add a secondary cache implementation based on LRUCache 1 (#9518) 2022-02-23 16:06:27 -08:00
java Change enum SizeApproximationFlags to enum class (#9604) 2022-02-18 20:22:57 -08:00
logging
memory
memtable
microbench
monitoring
options
plugin
port
table
test_util
third-party
tools Add a secondary cache implementation based on LRUCache 1 (#9518) 2022-02-23 16:06:27 -08:00
trace_replay
util Combine data members of IOStatus with Status (#9549) 2022-02-22 11:23:01 -08:00
utilities Support WBWI for keys having timestamps (#9603) 2022-02-22 14:23:01 -08:00
.clang-format
.gitignore
.lgtm.yml
.travis.yml
.watchmanconfig
AUTHORS
CMakeLists.txt Add a secondary cache implementation based on LRUCache 1 (#9518) 2022-02-23 16:06:27 -08:00
CODE_OF_CONDUCT.md
CONTRIBUTING.md
COPYING
DEFAULT_OPTIONS_HISTORY.md
DUMP_FORMAT.md
HISTORY.md Support WBWI for keys having timestamps (#9603) 2022-02-22 14:23:01 -08:00
INSTALL.md
LANGUAGE-BINDINGS.md
LICENSE.Apache
LICENSE.leveldb
Makefile Add a secondary cache implementation based on LRUCache 1 (#9518) 2022-02-23 16:06:27 -08:00
PLUGINS.md
README.md
ROCKSDB_LITE.md
TARGETS Add a secondary cache implementation based on LRUCache 1 (#9518) 2022-02-23 16:06:27 -08:00
USERS.md
Vagrantfile
WINDOWS_PORT.md
issue_template.md
src.mk Add a secondary cache implementation based on LRUCache 1 (#9518) 2022-02-23 16:06:27 -08:00
thirdparty.inc

README.md

RocksDB: A Persistent Key-Value Store for Flash and RAM Storage

CircleCI Status TravisCI Status Appveyor Build status PPC64le Build Status

RocksDB is developed and maintained by Facebook Database Engineering Team. It is built on earlier work on LevelDB by Sanjay Ghemawat (sanjay@google.com) and Jeff Dean (jeff@google.com)

This code is a library that forms the core building block for a fast key-value server, especially suited for storing data on flash drives. It has a Log-Structured-Merge-Database (LSM) design with flexible tradeoffs between Write-Amplification-Factor (WAF), Read-Amplification-Factor (RAF) and Space-Amplification-Factor (SAF). It has multi-threaded compactions, making it especially suitable for storing multiple terabytes of data in a single database.

Start with example usage here: https://github.com/facebook/rocksdb/tree/main/examples

See the github wiki for more explanation.

The public interface is in include/. Callers should not include or rely on the details of any other header files in this package. Those internal APIs may be changed without warning.

Questions and discussions are welcome on the RocksDB Developers Public Facebook group and email list on Google Groups.

License

RocksDB is dual-licensed under both the GPLv2 (found in the COPYING file in the root directory) and Apache 2.0 License (found in the LICENSE.Apache file in the root directory). You may select, at your option, one of the above-listed licenses.