Class OOCLRUCacheScheduler
java.lang.Object
org.apache.sysds.runtime.ooc.cache.legacy.OOCLRUCacheScheduler
- All Implemented Interfaces:
OOCCacheScheduler
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.sysds.runtime.ooc.cache.legacy.OOCCacheScheduler
OOCCacheScheduler.HandoverHandle -
Constructor Summary
ConstructorsConstructorDescriptionOOCLRUCacheScheduler(OOCIOHandler ioHandler, long evictionLimit, long hardLimit, long readBuffer) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddReference(BlockKey key) Notifies the cache that there is another reference to the same block key.voidForgets a block from the cache.longReturns the current cache size in bytes.longReturns the hard cache limit in bytes.longReturns the number of pinned bytes in the cache.handover(BlockKey key, InMemoryQueueCallback callback) booleanReturns if the current cache size is within its defined memory limits.booleanReturns if the current cache size is within its soft memory limits.voidpin(BlockEntry entry) Pins a BlockEntry in cache to prevent eviction.voidprioritize(BlockKey key, double priority) Adds the given priority to any pending request accessing the key.Places a new block in the cache.Places a new block in the cache and returns a pinned handle.putAndPinSourceBacked(BlockKey key, Object data, long size, OOCIOHandler.SourceBlockDescriptor descriptor) Places a new source-backed block in the cache and returns a pinned handle.voidputSourceBacked(BlockKey key, Object data, long size, OOCIOHandler.SourceBlockDescriptor descriptor) Places a new source-backed block in the cache and registers the location with the IO handler.Requests a list of blocks from the cache that must be available at the same time.Requests a single block from the cache.requestAnyOf(List<BlockKey> keys, int n, List<BlockKey> selectionOut) Requests any n entries of the list of blocks, preferring an available item.voidshutdown()Shuts down the cache scheduler.snapshot()Creates a snapshot of the cache.tryRequest(List<BlockKey> keys) Tries to request a list of blocks from the cache that must be available at the same time.tryRequestAnyOf(List<BlockKey> keys, int n, List<BlockKey> selectionOut) Requests any n entries of the list of blocks, preferring an available item.voidunpin(BlockEntry entry) Unpins a pinned block.voidupdateLimits(long evictionLimit, long hardLimit) Updates the cache limits.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.sysds.runtime.ooc.cache.legacy.OOCCacheScheduler
tryRequest
-
Constructor Details
-
OOCLRUCacheScheduler
public OOCLRUCacheScheduler(OOCIOHandler ioHandler, long evictionLimit, long hardLimit, long readBuffer)
-
-
Method Details
-
request
Description copied from interface:OOCCacheSchedulerRequests a single block from the cache.- Specified by:
requestin interfaceOOCCacheScheduler- Parameters:
key- the requested key associated to the block- Returns:
- the available BlockEntry
-
tryRequest
Description copied from interface:OOCCacheSchedulerTries to request a list of blocks from the cache that must be available at the same time. Immediately returns the list of entries if present, otherwise null without scheduling reads.- Specified by:
tryRequestin interfaceOOCCacheScheduler- Parameters:
keys- the requested keys associated to the block- Returns:
- the list of available BlockEntries
-
requestAnyOf
public CompletableFuture<List<BlockEntry>> requestAnyOf(List<BlockKey> keys, int n, List<BlockKey> selectionOut) Description copied from interface:OOCCacheSchedulerRequests any n entries of the list of blocks, preferring an available item.- Specified by:
requestAnyOfin interfaceOOCCacheScheduler
-
tryRequestAnyOf
Description copied from interface:OOCCacheSchedulerRequests any n entries of the list of blocks, preferring an available item.- Specified by:
tryRequestAnyOfin interfaceOOCCacheScheduler
-
request
Description copied from interface:OOCCacheSchedulerRequests a list of blocks from the cache that must be available at the same time.- Specified by:
requestin interfaceOOCCacheScheduler- Parameters:
keys- the requested keys associated to the block- Returns:
- the list of available BlockEntries
-
request
-
prioritize
Description copied from interface:OOCCacheSchedulerAdds the given priority to any pending request accessing the key. Multi-requests are prioritized partially.- Specified by:
prioritizein interfaceOOCCacheScheduler
-
put
Description copied from interface:OOCCacheSchedulerPlaces a new block in the cache. Note that objects are immutable and cannot be overwritten. The object data should now only be accessed via cache, as ownership has been transferred.- Specified by:
putin interfaceOOCCacheScheduler- Parameters:
key- the associated key of the blockdata- the block datasize- the size of the data
-
putAndPin
Description copied from interface:OOCCacheSchedulerPlaces a new block in the cache and returns a pinned handle. Note that objects are immutable and cannot be overwritten.- Specified by:
putAndPinin interfaceOOCCacheScheduler- Parameters:
key- the associated key of the blockdata- the block datasize- the size of the data
-
handover
- Specified by:
handoverin interfaceOOCCacheScheduler
-
putSourceBacked
public void putSourceBacked(BlockKey key, Object data, long size, OOCIOHandler.SourceBlockDescriptor descriptor) Description copied from interface:OOCCacheSchedulerPlaces a new source-backed block in the cache and registers the location with the IO handler. The entry is treated as backed by disk, so eviction does not schedule spill writes.- Specified by:
putSourceBackedin interfaceOOCCacheScheduler- Parameters:
key- the associated key of the blockdata- the block datasize- the size of the datadescriptor- the source location descriptor
-
putAndPinSourceBacked
public BlockEntry putAndPinSourceBacked(BlockKey key, Object data, long size, OOCIOHandler.SourceBlockDescriptor descriptor) Description copied from interface:OOCCacheSchedulerPlaces a new source-backed block in the cache and returns a pinned handle.- Specified by:
putAndPinSourceBackedin interfaceOOCCacheScheduler- Parameters:
key- the associated key of the blockdata- the block datasize- the size of the datadescriptor- the source location descriptor
-
addReference
Description copied from interface:OOCCacheSchedulerNotifies the cache that there is another reference to the same block key. This will prevent forget(key) from removing the block from cache. A block will only be forgotten after all referencing instances called forget(key).- Specified by:
addReferencein interfaceOOCCacheScheduler
-
forget
Description copied from interface:OOCCacheSchedulerForgets a block from the cache.- Specified by:
forgetin interfaceOOCCacheScheduler- Parameters:
key- the associated key of the block
-
pin
Description copied from interface:OOCCacheSchedulerPins a BlockEntry in cache to prevent eviction.- Specified by:
pinin interfaceOOCCacheScheduler- Parameters:
entry- the entry to be pinned
-
unpin
Description copied from interface:OOCCacheSchedulerUnpins a pinned block.- Specified by:
unpinin interfaceOOCCacheScheduler- Parameters:
entry- the entry to be unpinned
-
getCacheSize
public long getCacheSize()Description copied from interface:OOCCacheSchedulerReturns the current cache size in bytes.- Specified by:
getCacheSizein interfaceOOCCacheScheduler
-
getPinnedBytes
public long getPinnedBytes()Description copied from interface:OOCCacheSchedulerReturns the number of pinned bytes in the cache.- Specified by:
getPinnedBytesin interfaceOOCCacheScheduler
-
getHardLimit
public long getHardLimit()Description copied from interface:OOCCacheSchedulerReturns the hard cache limit in bytes.- Specified by:
getHardLimitin interfaceOOCCacheScheduler
-
isWithinLimits
public boolean isWithinLimits()Description copied from interface:OOCCacheSchedulerReturns if the current cache size is within its defined memory limits.- Specified by:
isWithinLimitsin interfaceOOCCacheScheduler
-
isWithinSoftLimits
public boolean isWithinSoftLimits()Description copied from interface:OOCCacheSchedulerReturns if the current cache size is within its soft memory limits.- Specified by:
isWithinSoftLimitsin interfaceOOCCacheScheduler
-
shutdown
public void shutdown()Description copied from interface:OOCCacheSchedulerShuts down the cache scheduler.- Specified by:
shutdownin interfaceOOCCacheScheduler
-
updateLimits
public void updateLimits(long evictionLimit, long hardLimit) Description copied from interface:OOCCacheSchedulerUpdates the cache limits.- Specified by:
updateLimitsin interfaceOOCCacheScheduler
-
snapshot
Description copied from interface:OOCCacheSchedulerCreates a snapshot of the cache. Should only be used for debugging or diagnoses.- Specified by:
snapshotin interfaceOOCCacheScheduler
-