org.apache.ignite.configuration

## Class MemoryConfiguration

- java.lang.Object
- - org.apache.ignite.configuration.MemoryConfiguration

- All Implemented Interfaces:
    Serializable

  Deprecated.
  Use `DataStorageConfiguration` instead.

      @Deprecated
      public class MemoryConfiguration
      extends Object
      implements Serializable

  A page memory configuration for an Apache Ignite node. The page memory is a manageable off-heap based memory architecture that divides all expandable memory regions into pages of fixed size (see `getPageSize()`. An individual page can store one or many cache key-value entries that allows reusing the memory in the most efficient way and avoid memory fragmentation issues.

  By default, the page memory allocates a single expandable memory region using settings of `createDefaultPolicyConfig()`. All the caches that will be configured in an application will be mapped to this memory region by default, thus, all the cache data will reside in that memory region.

  If initial size of the default memory region doesn't satisfy requirements or it's required to have multiple memory regions with different properties then `MemoryPolicyConfiguration` can be used for both scenarios. For instance, using memory policies you can define memory regions of different maximum size, eviction policies, swapping options, etc. Once you define a new memory region you can bind particular Ignite caches to it.

  To learn more about memory policies refer to `MemoryPolicyConfiguration` documentation.

  Sample configuration below shows how to make 5 GB memory regions the default one for Apache Ignite:

           <property name="memoryConfiguration">
               <bean class="org.apache.ignite.configuration.MemoryConfiguration">
                   <property name="systemCacheInitialSize" value="#{100L * 1024 * 1024}"/>
                   <property name="defaultMemoryPolicyName" value="default_mem_plc"/>

                   <property name="memoryPolicies">
                       <list>
                           <bean class="org.apache.ignite.configuration.MemoryPolicyConfiguration">
                               <property name="name" value="default_mem_plc"/>
                               <property name="initialSize" value="#{5L * 1024 * 1024 * 1024}"/>
                           </bean>
                       </list>
                   </property>
               </bean>
           </property>

  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DFLT_MEM_PLC_DEFAULT_NAME` Deprecated. This name is assigned to default DataRegion if no user-defined default MemPlc is specified
    `static long` | `DFLT_MEMORY_POLICY_INITIAL_SIZE` Deprecated. Default memory policy start size (256 MB).
    `static long` | `DFLT_MEMORY_POLICY_MAX_SIZE` Deprecated. Default memory policy's size is 20% of physical memory available on current machine.
    `static int` | `DFLT_PAGE_SIZE` Deprecated. Default memory page size.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MemoryConfiguration()` Deprecated.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `MemoryPolicyConfiguration` | `createDefaultPolicyConfig()` Deprecated. Creates a configuration for the default memory policy that will instantiate the default memory region.
    `int` | `getConcurrencyLevel()` Deprecated. Returns the number of concurrent segments in Ignite internal page mapping tables.
    `String` | `getDefaultMemoryPolicyName()` Deprecated. Gets a name of default memory policy.
    `long` | `getDefaultMemoryPolicySize()` Deprecated. Gets a size for default memory policy overridden by user.
    `MemoryPolicyConfiguration[]` | `getMemoryPolicies()` Deprecated. Gets an array of all memory policies configured.
    `int` | `getPageSize()` Deprecated. The pages memory consists of one or more expandable memory regions defined by `MemoryPolicyConfiguration`.
    `long` | `getSystemCacheInitialSize()` Deprecated. Initial size of a memory region reserved for system cache.
    `long` | `getSystemCacheMaxSize()` Deprecated. Maximum memory region size reserved for system cache.
    `MemoryConfiguration` | `setConcurrencyLevel(int concLvl)` Deprecated. Sets the number of concurrent segments in Ignite internal page mapping tables.
    `MemoryConfiguration` | `setDefaultMemoryPolicyName(String dfltMemPlcName)` Deprecated. Sets the name for the default memory policy that will initialize the default memory region.
    `MemoryConfiguration` | `setDefaultMemoryPolicySize(long dfltMemPlcSize)` Deprecated. Overrides size of default memory policy which is created automatically.
    `MemoryConfiguration` | `setMemoryPolicies(MemoryPolicyConfiguration... memPlcs)` Deprecated. Sets memory policies configurations.
    `MemoryConfiguration` | `setPageSize(int pageSize)` Deprecated. Changes the page size.
    `MemoryConfiguration` | `setSystemCacheInitialSize(long sysCacheInitSize)` Deprecated. Sets initial size of a memory region reserved for system cache.
    `MemoryConfiguration` | `setSystemCacheMaxSize(long sysCacheMaxSize)` Deprecated. Sets maximum memory region size reserved for system cache.
    `String` | `toString()` Deprecated.

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### DFLT_MEMORY_POLICY_INITIAL_SIZE

          public static final long DFLT_MEMORY_POLICY_INITIAL_SIZE

      Deprecated.
      Default memory policy start size (256 MB).
      See Also:
        Constant Field Values

    - #### DFLT_MEMORY_POLICY_MAX_SIZE

          public static final long DFLT_MEMORY_POLICY_MAX_SIZE

      Deprecated.
      Default memory policy's size is 20% of physical memory available on current machine.

    - #### DFLT_PAGE_SIZE

          public static final int DFLT_PAGE_SIZE

      Deprecated.
      Default memory page size.
      See Also:
        Constant Field Values

    - #### DFLT_MEM_PLC_DEFAULT_NAME

          public static final String DFLT_MEM_PLC_DEFAULT_NAME

      Deprecated.
      This name is assigned to default DataRegion if no user-defined default MemPlc is specified
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### MemoryConfiguration

          public MemoryConfiguration()

      Deprecated.

  - ### Method Detail

    - #### getSystemCacheInitialSize

          public long getSystemCacheInitialSize()

      Deprecated.
      Initial size of a memory region reserved for system cache.
      Returns:
        Size in bytes.

    - #### setSystemCacheInitialSize

          public MemoryConfiguration setSystemCacheInitialSize(long sysCacheInitSize)

      Deprecated.
      Sets initial size of a memory region reserved for system cache. Default value is `DFLT_SYS_CACHE_INIT_SIZE`
      Parameters:
        `sysCacheInitSize` - Size in bytes.
      Returns:
        `this` for chaining.

    - #### getSystemCacheMaxSize

          public long getSystemCacheMaxSize()

      Deprecated.
      Maximum memory region size reserved for system cache.
      Returns:
        Size in bytes.

    - #### setSystemCacheMaxSize

          public MemoryConfiguration setSystemCacheMaxSize(long sysCacheMaxSize)

      Deprecated.
      Sets maximum memory region size reserved for system cache. The total size should not be less than 10 MB due to internal data structures overhead.
      Parameters:
        `sysCacheMaxSize` - Maximum size in bytes for system cache memory region.
      Returns:
        `this` for chaining.

    - #### getPageSize

          public int getPageSize()

      Deprecated.
      The pages memory consists of one or more expandable memory regions defined by `MemoryPolicyConfiguration`. Every memory region is split on pages of fixed size that store actual cache entries.
      Returns:
        Page size in bytes.

    - #### setPageSize

          public MemoryConfiguration setPageSize(int pageSize)

      Deprecated.
      Changes the page size. Default value is `DFLT_PAGE_SIZE`
      Parameters:
        `pageSize` - Page size in bytes.
      Returns:
        `this` for chaining.

    - #### getMemoryPolicies

          public MemoryPolicyConfiguration[] getMemoryPolicies()

      Deprecated.
      Gets an array of all memory policies configured. Apache Ignite will instantiate a dedicated memory region per policy. An Apache Ignite cache can be mapped to a specific policy with `CacheConfiguration.setMemoryPolicyName(String)` method.
      Returns:
        Array of configured memory policies.

    - #### setMemoryPolicies

          public MemoryConfiguration setMemoryPolicies(MemoryPolicyConfiguration... memPlcs)

      Deprecated.
      Sets memory policies configurations.
      Parameters:
        `memPlcs` - Memory policies configurations.
      Returns:
        `this` for chaining.

    - #### createDefaultPolicyConfig

          public MemoryPolicyConfiguration createDefaultPolicyConfig()

      Deprecated.
      Creates a configuration for the default memory policy that will instantiate the default memory region. To override settings of the default memory policy in order to create the default memory region with different parameters, create own memory policy first, pass it to `setMemoryPolicies(MemoryPolicyConfiguration...)` method and change the name of the default memory policy with `setDefaultMemoryPolicyName(String)`.
      Returns:
        default Memory policy configuration.

    - #### getConcurrencyLevel

          public int getConcurrencyLevel()

      Deprecated.
      Returns the number of concurrent segments in Ignite internal page mapping tables. By default equals to the number of available CPUs multiplied by 4.
      Returns:
        Mapping table concurrency level.

    - #### setConcurrencyLevel

          public MemoryConfiguration setConcurrencyLevel(int concLvl)

      Deprecated.
      Sets the number of concurrent segments in Ignite internal page mapping tables.
      Parameters:
        `concLvl` - Mapping table concurrency level.
      Returns:
        `this` for chaining.

    - #### getDefaultMemoryPolicySize

          public long getDefaultMemoryPolicySize()

      Deprecated.
      Gets a size for default memory policy overridden by user.
      Returns:
        Default memory policy size overridden by user or `DFLT_MEMORY_POLICY_MAX_SIZE` if nothing was specified.

    - #### setDefaultMemoryPolicySize

          public MemoryConfiguration setDefaultMemoryPolicySize(long dfltMemPlcSize)

      Deprecated.
      Overrides size of default memory policy which is created automatically. If user doesn't specify any memory policy configuration, a default one with default size (20% of available RAM) is created by Ignite. This property allows user to specify desired size of default memory policy without having to use more verbose syntax of MemoryPolicyConfiguration elements.
      Parameters:
        `dfltMemPlcSize` - Size of default memory policy overridden by user.
      Returns:
        `this` for chaining.

    - #### getDefaultMemoryPolicyName

          public String getDefaultMemoryPolicyName()

      Deprecated.
      Gets a name of default memory policy.
      Returns:
        A name of a custom memory policy configured with `MemoryConfiguration` or `null` of the default policy is used.

    - #### setDefaultMemoryPolicyName

          public MemoryConfiguration setDefaultMemoryPolicyName(String dfltMemPlcName)

      Deprecated.
      Sets the name for the default memory policy that will initialize the default memory region. To set own default memory policy, create the policy first, pass it to `setMemoryPolicies(MemoryPolicyConfiguration...)` method and change the name of the default memory policy with `MemoryConfiguration#setDefaultMemoryPolicyName(String)`. If nothing is specified by user, it is set to `DFLT_MEM_PLC_DEFAULT_NAME` value.
      Parameters:
        `dfltMemPlcName` - Name of a memory policy to be used as default one.
      Returns:
        `this` for chaining.

    - #### toString

          public String toString()

      Deprecated.
      Overrides:
        `toString` in class `Object`

${current.year} Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.16.0
Release Date | : December 15 2023