Package org.rocksdb
Class HyperClockCache
- java.lang.Object
-
- org.rocksdb.AbstractNativeReference
-
- org.rocksdb.AbstractImmutableNativeReference
-
- org.rocksdb.RocksObject
-
- org.rocksdb.Cache
-
- org.rocksdb.HyperClockCache
-
- All Implemented Interfaces:
java.lang.AutoCloseable
@Experimental("HyperClockCache is still experimental and this API may change in future.") public class HyperClockCache extends Cache
HyperClockCache - A lock-free Cache alternative for RocksDB block cache that offers much improved CPU efficiency vs. LRUCache under high parallel load or high contention, with some caveats:- Not a general Cache implementation: can only be used for BlockBasedTableOptions::block_cache, which RocksDB uses in a way that is compatible with HyperClockCache.
- Requires an extra tuning parameter: see estimated_entry_charge below. Similarly, substantially changing the capacity with SetCapacity could harm efficiency. -> EXPERIMENTAL: the tuning parameter can be set to 0 to find the appropriate balance automatically.
- Cache priorities are less aggressively enforced, which could cause cache dilution from long range scans (unless they use fill_cache=false).
- Can be worse for small caches, because if almost all of a cache shard is pinned (more likely with non-partitioned filters), then CLOCK eviction becomes very CPU intensive.
-
-
Field Summary
-
Fields inherited from class org.rocksdb.RocksObject
nativeHandle_
-
Fields inherited from class org.rocksdb.AbstractImmutableNativeReference
owningHandle_
-
-
Constructor Summary
Constructors Constructor Description HyperClockCache(long capacity, long estimatedEntryCharge, int numShardBits, boolean strictCapacityLimit)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddisposeInternal(long handle)-
Methods inherited from class org.rocksdb.Cache
getPinnedUsage, getUsage
-
Methods inherited from class org.rocksdb.RocksObject
disposeInternal, getNativeHandle
-
Methods inherited from class org.rocksdb.AbstractImmutableNativeReference
close, disOwnNativeHandle, isOwningHandle
-
-
-
-
Constructor Detail
-
HyperClockCache
public HyperClockCache(long capacity, long estimatedEntryCharge, int numShardBits, boolean strictCapacityLimit)- Parameters:
capacity- The fixed size capacity of the cacheestimatedEntryCharge- EXPERIMENTAL: the field can be set to 0 to size the table dynamically and automatically. See C++ Api for more info.numShardBits- The cache is sharded to 2^numShardBits shards, by hash of the keystrictCapacityLimit- insert to the cache will fail when cache is full
-
-
Method Detail
-
disposeInternal
protected void disposeInternal(long handle)
- Specified by:
disposeInternalin classRocksObject
-
-