|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface IGlobalLRU<K,V>
Factory for per-IRawStore caches backed by a global LRU allowing
competition for buffer space across all requests for decompressed records,
including B+Tree INodeData and ILeafData objects.
The vast majority of all data in the stores are B+Tree INodeData and
ILeafData records. This factory provides per-IRawStore cache
instances which can dramatically reduce read IO for B+Trees, and thus for the
entire database. This also serves as the "leafCache" for the
IndexSegment, which uses linked-leaf navigation for
ITupleIterator and ITupleCursors and does not otherwise
buffer leaves when performing key range scans (versus top-down navigation).
There is one cache per store. All cache instances are backed by a shared Least Recently Used (LRU) policy. Entries will be evicted from the appropriate cache as they fall of the end of the LRU. A global LRU ensures that all cache instances compete for the same memory resources.
Each per-store cache provides a canonicalizing mapping from the Long
address of a record to a WeakReference value. The referent of the
WeakReference may be an IDataRecord, INodeData,
ILeafData, or other object whose persistent state was coded by (or
serialized by) the record having that address.
Note: The individual cache instances for each IRawStore reclaim JVM
heap space as the WeakReference values are cleared. The set of such
instances is also a ConcurrentWeakValueCache with a backing LRU so we
can hold onto the canonicalizing mappings for closed stores which might be
reopened.
Note: The global LRU may have impact on GC of the old generation since there will be a tendency of the backing byte[]s to be held long enough to become tenured. Newer incremental garbage collections are designed to address this problem.
Note: While caching compressed records would have a smaller memory footprint,
this class provides for caching decompressed records since high-level data
structures (such as the B+Trees) do not retain references to the compressed
data records. Therefore a compressed data record cache based on weak
reference semantics for the compressed ByteBuffers would be of little
utility.
long? By getting rid of this generic type
as can allow native long hash map implementations.| Nested Class Summary | |
|---|---|
static interface |
IGlobalLRU.IGlobalLRUCounters
Interface defines some standard counters for the global LRU. |
static interface |
IGlobalLRU.ILRUCache<K,V>
Interface for cache of read-only records from a specific IRawStore backed by a shared LRU. |
| Method Summary | |
|---|---|
void |
deleteCache(UUID storeUUID)
Remove the cache for the IRawStore from the set of caches
maintained by this class and clear any entries in that cache. |
void |
discardAllCaches()
Clear all per- IRawStore cache instances. |
IGlobalLRU.ILRUCache<K,V> |
getCache(UUID storeUUID,
IAddressManager am)
An canonicalizing factory for cache instances supporting random access to decompressed IDataRecords, higher-level data structures wrapping
those decompressed data records (INodeData and ILeafData
), or objects deserialized from those IDataRecords. |
CounterSet |
getCounterSet()
The counters for the global LRU. |
| Method Detail |
|---|
IGlobalLRU.ILRUCache<K,V> getCache(UUID storeUUID,
IAddressManager am)
IDataRecords, higher-level data structures wrapping
those decompressed data records (INodeData and ILeafData
), or objects deserialized from those IDataRecords.
storeUUID - The store's UUID.am - The IAddressManager for that store (optional, but used
to compute the bytes on disk for record and hence highly
desired).
AbstractBTree.readNodeOrLeaf(long),
IndexSegmentStore.reopen(),
LRUNexus.getCache(IRawStore)void deleteCache(UUID storeUUID)
IRawStore from the set of caches
maintained by this class and clear any entries in that cache. This method
SHOULD be used when the persistent resources for the store are deleted.
It SHOULD NOT be used if a store is simply closed in a context when the
store COULD be re-opened. In such cases, the cache for that store will be
automatically released after it has become only weakly reachable.
storeUUID - The store's UUID.IRawStore.destroy(),
IRawStore.deleteResources()void discardAllCaches()
IRawStore cache instances. This may be used if all
bigdata instances in the JVM are closed, but SHOULD NOT be invoked if you
are just closing some IRawStore.
CounterSet getCounterSet()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||