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.
  • Field Details

    • DEFAULT_HEAP_FRACTION

      static final double DEFAULT_HEAP_FRACTION
      See Also:
    • DEFAULT_MIN_SIZE_STRING

      static final String 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

      static final String 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

      static final String 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, if enable-soft-references is enabled, else .6 (60%) is assumed.
    • fractionMinSize

      @WithDefault("64M") Optional<org.apache.polaris.misc.types.memorysize.MemorySize> 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

      @WithDefault("0.1") OptionalDouble cacheCapacityOvershoot()
      Admitted cache-capacity-overshoot fraction, defaults to 0.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

      static CacheSizing.Builder builder()
    • check

      @Check default void check()