-
Notifications
You must be signed in to change notification settings - Fork 6.4k
SecondaryCache (Experimental)
SecondaryCache
is the interface for caching blocks on a secondary tier, which can be a non-volatile media or alternate forms of caching such as compressed data. The purpose of the secondary cache is to support other ways of caching the object, such as persistent or compressed data. It can be viewed as an extension of RocksDB’s current volatile block cache. The RocksDB team has created two concrete implementations of SecondaryCache
, a Cachelib
based implementation on non-volatile media and a LRUCache
based implementation (CompressedSecondaryCache
) on DRAM.
To build a concrete SecondaryCache
, you need to prepare the implementations of SecondaryCacheResultHandle
, SecondaryCache
, and some callbacks. Their details can be found in secondary_cache.h
and cache.h
.
-
SecondaryCacheResultHandle
refers to an item in the secondary cache. - The callbacks in
CacheItemHelper
must be implemented for saving items to and restoring them from the secondary cache. -
SecondaryCache
includes the essential abstract functions of the secondary cache.
To integrate the secondary cache with the primary cache, a SecondaryCache
can be configured by adding a pointer to it in LRUCacheOptions
.
CompressedSecondaryCache
leverages compression libraries (e.g. LZ4) to compress items and stores the compressed blocks into an LRUCache
. User can create a secondary cache instance by calling NewCompressedSecondaryCache
. The options can be passed in respectively or together in CompressedSecondaryCacheOptions
. The options extend LRUCacheOptions
by adding the following two options for compression.
-
compression_type
: The compression method (if any) that is used to compress data. -
compress_format_version
: The format version needed by some compression methods.
CompressedSecondaryCacheOptions secondary_cache_opts;
secondary_cache_opts.capacity = sec_cache_capacity;
LRUCacheOptions lru_cache_opts(cache_capacity);
lru_cache_opts.secondary_cache = NewCompressedSecondaryCache(secondary_cache_opts);
std::shared_ptr<Cache> cache = NewLRUCache(lru_cache_opts);
LRUCacheOptions lru_cache_opts(cache_capacity);
lru_cache_opts.secondary_cache = NewCompressedSecondaryCache(secondary_cache_capacity);
std::shared_ptr<Cache> cache = NewLRUCache(lru_cache_opts);
This blog includes the initial introduction to SecondaryCache
.
Contents
- RocksDB Wiki
- Overview
- RocksDB FAQ
- Terminology
- Requirements
- Contributors' Guide
- Release Methodology
- RocksDB Users and Use Cases
- RocksDB Public Communication and Information Channels
-
Basic Operations
- Iterator
- Prefix seek
- SeekForPrev
- Tailing Iterator
- Compaction Filter
- Multi Column Family Iterator
- Read-Modify-Write (Merge) Operator
- Column Families
- Creating and Ingesting SST files
- Single Delete
- Low Priority Write
- Time to Live (TTL) Support
- Transactions
- Snapshot
- DeleteRange
- Atomic flush
- Read-only and Secondary instances
- Approximate Size
- User-defined Timestamp
- Wide Columns
- BlobDB
- Online Verification
- Options
- MemTable
- Journal
- Cache
- Write Buffer Manager
- Compaction
- SST File Formats
- IO
- Compression
- Full File Checksum and Checksum Handoff
- Background Error Handling
- Huge Page TLB Support
- Tiered Storage (Experimental)
- Logging and Monitoring
- Known Issues
- Troubleshooting Guide
- Tests
- Tools / Utilities
-
Implementation Details
- Delete Stale Files
- Partitioned Index/Filters
- WritePrepared-Transactions
- WriteUnprepared-Transactions
- How we keep track of live SST files
- How we index SST
- Merge Operator Implementation
- RocksDB Repairer
- Write Batch With Index
- Two Phase Commit
- Iterator's Implementation
- Simulation Cache
- [To Be Deprecated] Persistent Read Cache
- DeleteRange Implementation
- unordered_write
- Extending RocksDB
- RocksJava
- Lua
- Performance
- Projects Being Developed
- Misc