Interface CacheSizing
@PolarisImmutable
public interface CacheSizing
Parameters to size the persistence cache. It is recommended to leave the defaults. If changes are
necessary, prefer the heap-size relative options over a fixed cache size, because relative sizing
is portable across instances with different heap sizes.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic CacheSizing.Builderbuilder()Admitted cache-capacity-overshoot fraction, defaults to0.1(10 %).default longcalculateEffectiveSize(long maxHeapInBytes, double defaultHeapFraction) default voidcheck()Optional<org.apache.polaris.misc.types.memorysize.MemorySize> Capacity of the persistence cache in MiB.Optional<org.apache.polaris.misc.types.memorysize.MemorySize> When using fractional cache sizing, this amount in MB of the heap will always be "kept free" when calculating the cache size.Optional<org.apache.polaris.misc.types.memorysize.MemorySize> When using fractional cache sizing, this amount in MB is the minimum cache size.Fraction of Java’s max heap size to use for cache objects, set to 0 to disable.
-
Field Details
-
DEFAULT_HEAP_FRACTION
static final double DEFAULT_HEAP_FRACTION- See Also:
-
DEFAULT_MIN_SIZE_STRING
- See Also:
-
DEFAULT_MIN_SIZE
static final org.apache.polaris.misc.types.memorysize.MemorySize DEFAULT_MIN_SIZE -
DEFAULT_HEAP_SIZE_KEEP_FREE_STRING
- See Also:
-
DEFAULT_HEAP_SIZE_KEEP_FREE
static final org.apache.polaris.misc.types.memorysize.MemorySize DEFAULT_HEAP_SIZE_KEEP_FREE -
DEFAULT_CACHE_CAPACITY_OVERSHOOT
static final double DEFAULT_CACHE_CAPACITY_OVERSHOOT- See Also:
-
DEFAULT_CACHE_CAPACITY_OVERSHOOT_STRING
- See Also:
-
-
Method Details
-
fractionOfMaxHeapSize
OptionalDouble fractionOfMaxHeapSize()Fraction of Java’s max heap size to use for cache objects, set to 0 to disable. Must not be used with fixed cache sizing. If neither this value nor a fixed size is configured, a default of.4(40%) is assumed, ifenable-soft-referencesis enabled, else.6(60%) is assumed. -
fractionMinSize
When using fractional cache sizing, this amount in MB is the minimum cache size. -
fractionAdjustment
@WithDefault("256M") Optional<org.apache.polaris.misc.types.memorysize.MemorySize> fractionAdjustment()When using fractional cache sizing, this amount in MB of the heap will always be "kept free" when calculating the cache size. -
fixedSize
Optional<org.apache.polaris.misc.types.memorysize.MemorySize> fixedSize()Capacity of the persistence cache in MiB. -
cacheCapacityOvershoot
Admitted cache-capacity-overshoot fraction, defaults to0.1(10 %).New elements are admitted to be added to the cache, if the cache's size is less than
cache-capacity * (1 + cache-capacity-overshoot.Cache eviction happens asynchronously. Situations when eviction cannot keep up with the amount of data added could lead to out-of-memory situations.
The value, if present, must be greater than 0.
-
calculateEffectiveSize
default long calculateEffectiveSize(long maxHeapInBytes, double defaultHeapFraction) -
builder
-
check
@Check default void check()
-