Class PersistentCachePreloadingConfiguration
- java.lang.Object
-
- org.apache.jackrabbit.oak.segment.spi.persistence.persistentcache.PersistentCachePreloadingConfiguration
-
public class PersistentCachePreloadingConfiguration extends Object
Configuration for a segment preload mechanism that preloads segments into aPersistentCache. The preload mechanism is triggered whenever a segment in the cache is {@link PersistentCache#readSegment(long, long, Callable)|accessed}. When this happens, all segments referenced by the accessed segment are asynchronously preloaded.Next to the concurrency level, i.e. how many threads are used for preloading, the
maxPreloadDepth(default:1, which controls how many recursive levels of referenced segments are preloaded, can be configured.Prefetching is done asynchronously, but it may add some overhead. It is primarily recommended to parallelize slow I/O, e.g. when using a remote persistence.
Different scenarios may warrant different preloading strategies. A short-lived process traversing a repository (e.g. copy, offline-compaction) with an initially empty cache may benefit from a more threads and a higher preload-depth, while a long-running process, e.g. a web application, may perform better with fewer threads and a lower preload depth.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetConcurrency()intgetMaxPreloadDepth()StringtoString()static PersistentCachePreloadingConfigurationwithConcurrency(int concurrency)Creates a newPersistentCachePreloadingConfigurationwith the given concurrency level and apreloadDepthof1.PersistentCachePreloadingConfigurationwithMaxPreloadDepth(int maxPreloadDepth)Set how many recursive levels of referenced segments should be preloaded.
-
-
-
Method Detail
-
withConcurrency
public static PersistentCachePreloadingConfiguration withConcurrency(int concurrency)
Creates a newPersistentCachePreloadingConfigurationwith the given concurrency level and apreloadDepthof1.- Parameters:
concurrency- number of threads to use for preloading- Returns:
- a new configuration
-
withMaxPreloadDepth
public PersistentCachePreloadingConfiguration withMaxPreloadDepth(int maxPreloadDepth)
Set how many recursive levels of referenced segments should be preloaded.- Parameters:
maxPreloadDepth- depth of the preloading, i.e. how many levels of referenced segments should be preloaded (default:1)- Returns:
- this configuration
-
getConcurrency
public int getConcurrency()
-
getMaxPreloadDepth
public int getMaxPreloadDepth()
-
-