org.apache.ignite.configuration

## Enum DataPageEvictionMode

- java.lang.Object
- - java.lang.Enum<DataPageEvictionMode>
  - - org.apache.ignite.configuration.DataPageEvictionMode

- All Implemented Interfaces:
    Serializable, Comparable<DataPageEvictionMode>

      public enum DataPageEvictionMode
      extends Enum<DataPageEvictionMode>

  Defines memory page eviction algorithm. A mode is set for a specific `DataRegionConfiguration`. Only data pages, that store key-value entries, are eligible for eviction. The other types of pages, like index or meta pages, are not evictable.

- - ### Enum Constant Summary

    Enum Constants
    Enum Constant and Description
    `DISABLED` Eviction is disabled.
    `RANDOM_2_LRU` Random-2-LRU algorithm: scan-resistant version of Random-LRU.
    `RANDOM_LRU` Random-LRU algorithm.

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static @Nullable DataPageEvictionMode` | `fromOrdinal(int ord)` Efficiently gets enumerated value from its ordinal.
    `static DataPageEvictionMode` | `valueOf(String name)` Returns the enum constant of this type with the specified name.
    `static DataPageEvictionMode[]` | `values()` Returns an array containing the constants of this enum type, in the order they are declared.

    - ### Methods inherited from class java.lang.Enum

      `clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Enum Constant Detail

    - #### DISABLED

          public static final DataPageEvictionMode DISABLED

      Eviction is disabled.

    - #### RANDOM_LRU

          public static final DataPageEvictionMode RANDOM_LRU

      Random-LRU algorithm.
      - Once a memory region defined by a data region is configured, an off-heap array is allocated to track last usage timestamp for every individual data page. The size of the array is calculated this way - size = (`DataRegionConfiguration.getMaxSize()` / `DataStorageConfiguration.pageSize`)
      - When a data page is accessed, its timestamp gets updated in the tracking array. The page index in the tracking array is calculated this way - index = (pageAddress / `DataRegionConfiguration.getMaxSize()`
      - When it's required to evict some pages, the algorithm randomly chooses 5 indexes from the tracking array and evicts a page with the latest timestamp. If some of the indexes point to non-data pages (index or system pages) then the algorithm picks other pages.

    - #### RANDOM_2_LRU

          public static final DataPageEvictionMode RANDOM_2_LRU

      Random-2-LRU algorithm: scan-resistant version of Random-LRU.

      This algorithm differs from Random-LRU only in a way that two latest access timestamps are stored for every data page. At the eviction time, a minimum between two latest timestamps is taken for further comparison with minimums of other pages that might be evicted. LRU-2 outperforms LRU by resolving "one-hit wonder" problem - if a data page is accessed rarely, but accidentally accessed once, it's protected from eviction for a long time.

  - ### Method Detail

    - #### values

          public static DataPageEvictionMode[] values()

      Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

          for (DataPageEvictionMode c : DataPageEvictionMode.values())
              System.out.println(c);

      Returns:
        an array containing the constants of this enum type, in the order they are declared

    - #### valueOf

          public static DataPageEvictionMode valueOf(String name)

      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
        `name` - the name of the enum constant to be returned.
      Returns:
        the enum constant with the specified name
      Throws:
        `IllegalArgumentException` - if this enum type has no constant with the specified name
        `NullPointerException` - if the argument is null

    - #### fromOrdinal

          @Nullable
          public static @Nullable DataPageEvictionMode fromOrdinal(int ord)

      Efficiently gets enumerated value from its ordinal.
      Parameters:
        `ord` - Ordinal value.
      Returns:
        Enumerated value or `null` if ordinal out of range.

2021 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.11.0
Release Date | : September 11 2021