Class DataRegionConfiguration

  • All Implemented Interfaces:
    Serializable

    public final class DataRegionConfiguration
    extends Object
    implements Serializable
    This class allows defining custom data regions' configurations with various parameters for Apache Ignite page memory (see DataStorageConfiguration. For each configured data region Apache Ignite instantiates respective memory regions with different parameters like maximum size, eviction policy, swapping options, persistent mode flag, etc. An Apache Ignite cache can be mapped to a particular region using CacheConfiguration.setDataRegionName(String) method.

    Sample configuration below shows how to configure several data regions:

         
         <property name="memoryConfiguration">
             <bean class="org.apache.ignite.configuration.DataStorageConfiguration">
                 <property name="defaultRegionConfiguration">
                     <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
                         <property name="name" value="Default_Region"/>
                         <property name="initialSize" value="#{100L * 1024 * 1024}"/>
                         <property name="maxSize" value="#{5L * 1024 * 1024 * 1024}"/>
                     </bean>
                 </property>
    
                 <property name="pageSize" value="4096"/>
    
                 <property name="dataRegions">
                     <list>
                          <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
                              <property name="name" value="20MB_Region_Eviction"/>
                              <property name="initialSize" value="#{20L * 1024 * 1024}"/>
                              <property name="pageEvictionMode" value="RANDOM_2_LRU"/>
                          </bean>
    
                          <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
                              <property name="name" value="25MB_Region_Swapping"/>
                              <property name="initialSize" value="#{25L * 1024 * 1024}"/>
                              <property name="maxSize" value="#{100L * 1024 * 1024}"/>
                              <property name="swapPath" value="db/swap"/>
                          </bean>
                      </list>
                  </property>
         
     
    See Also:
    Serialized Form
    • Constructor Detail

      • DataRegionConfiguration

        public DataRegionConfiguration()
    • Method Detail

      • getName

        public String getName()
        Gets data region name.
        Returns:
        Data region name.
      • getMaxSize

        public long getMaxSize()
        Maximum memory region size defined by this data region. If the whole data can not fit into the memory region an out of memory exception will be thrown.
        Returns:
        Size in bytes.
      • setMaxSize

        public DataRegionConfiguration setMaxSize​(long maxSize)
        Sets maximum memory region size defined by this data region. The total size should not be less than 10 MB due to the internal data structures overhead.
        Parameters:
        maxSize - Maximum data region size in bytes.
        Returns:
        this for chaining.
      • getInitialSize

        public long getInitialSize()
        Gets initial memory region size defined by this data region. When the used memory size exceeds this value, new chunks of memory will be allocated.
        Returns:
        Data region start size.
      • setInitialSize

        public DataRegionConfiguration setInitialSize​(long initSize)
        Sets initial memory region size defined by this data region. When the used memory size exceeds this value, new chunks of memory will be allocated.
        Parameters:
        initSize - Data region initial size.
        Returns:
        this for chaining.
      • getSwapPath

        public String getSwapPath()
        A path to the memory-mapped files the memory region defined by this data region will be mapped to. Having the path set, allows relying on swapping capabilities of an underlying operating system for the memory region.
        Returns:
        A path to the memory-mapped files or null if this feature is not used for the memory region defined by this data region.
      • setSwapPath

        public DataRegionConfiguration setSwapPath​(String swapPath)
        Sets a path to the memory-mapped files.
        Parameters:
        swapPath - A Path to the memory mapped file.
        Returns:
        this for chaining.
      • getMemoryAllocator

        @Nullable
        public @Nullable MemoryAllocator getMemoryAllocator()
        Returns:
        Memory allocator instance.
      • setMemoryAllocator

        public DataRegionConfiguration setMemoryAllocator​(MemoryAllocator allocator)
        Sets memory allocator. If not specified, default, based on Unsafe allocator will be used.
        Parameters:
        allocator - Memory allocator instance.
        Returns:
        this for chaining.
      • setPageEvictionMode

        public DataRegionConfiguration setPageEvictionMode​(DataPageEvictionMode evictionMode)
        Sets memory pages eviction mode.
        Parameters:
        evictionMode - Eviction mode.
        Returns:
        this for chaining.
      • getPageReplacementMode

        public PageReplacementMode getPageReplacementMode()
        Gets memory pages replacement mode. If persistence is enabled and Ignite store on disk more data then available data region memory (getMaxSize()) page replacement can be started to rotate memory pages with the disk. This parameter defines the algorithm to find pages to replace. Note: For not persistent data regions see page eviction mode (getPageEvictionMode()).
        Returns:
        Memory pages replacement algorithm. PageReplacementMode.CLOCK used by default.
      • setPageReplacementMode

        public DataRegionConfiguration setPageReplacementMode​(PageReplacementMode replacementMode)
        Sets memory pages replacement mode.
        Parameters:
        replacementMode - Page replacement mode.
        Returns:
        this for chaining.
      • getEvictionThreshold

        public double getEvictionThreshold()
        Gets a threshold for memory pages eviction initiation. For instance, if the threshold is 0.9 it means that the page memory will start the eviction only after 90% of the data region is occupied.
        Returns:
        Memory pages eviction threshold.
      • setEvictionThreshold

        public DataRegionConfiguration setEvictionThreshold​(double evictionThreshold)
        Sets memory pages eviction threshold.
        Parameters:
        evictionThreshold - Eviction threshold.
        Returns:
        this for chaining.
      • getEmptyPagesPoolSize

        public int getEmptyPagesPoolSize()
        Specifies the minimal number of empty pages to be present in reuse lists for this data region. This parameter ensures that Ignite will be able to successfully evict old data entries when the size of (key, value) pair is slightly larger than page size / 2. Increase this parameter if cache can contain very big entries (total size of pages in this pool should be enough to contain largest cache entry). Increase this parameter if IgniteOutOfMemoryException occurred with enabled page eviction.
        Returns:
        Minimum number of empty pages in reuse list.
      • setEmptyPagesPoolSize

        public DataRegionConfiguration setEmptyPagesPoolSize​(int emptyPagesPoolSize)
        Specifies the minimal number of empty pages to be present in reuse lists for this data region. This parameter ensures that Ignite will be able to successfully evict old data entries when the size of (key, value) pair is slightly larger than page size / 2. Increase this parameter if cache can contain very big entries (total size of pages in this pool should be enough to contain largest cache entry). Increase this parameter if IgniteOutOfMemoryException occurred with enabled page eviction.
        Parameters:
        emptyPagesPoolSize - Empty pages pool size.
        Returns:
        this for chaining.
      • isMetricsEnabled

        public boolean isMetricsEnabled()
        Gets whether memory metrics are enabled by default on node startup. Memory metrics can be enabled and disabled at runtime via memory metrics "name=io.dataregion.{data_region_name}" mx bean.
        Returns:
        Metrics enabled flag.
      • setMetricsEnabled

        public DataRegionConfiguration setMetricsEnabled​(boolean metricsEnabled)
        Sets memory metrics enabled flag. If this flag is true, metrics will be enabled on node startup. Memory metrics can be enabled and disabled at runtime via memory metrics "name=io.dataregion.{data_region_name}" mx bean.
        Parameters:
        metricsEnabled - Metrics enabled flag.
        Returns:
        this for chaining.
      • isPersistenceEnabled

        public boolean isPersistenceEnabled()
        Gets whether persistence is enabled for this data region. All caches residing in this region will be persistent.
        Returns:
        Persistence enabled flag.
      • setPersistenceEnabled

        public DataRegionConfiguration setPersistenceEnabled​(boolean persistenceEnabled)
        Sets persistence enabled flag.
        Parameters:
        persistenceEnabled - Persistence enabled flag.
        Returns:
        this for chaining.
      • getCheckpointPageBufferSize

        public long getCheckpointPageBufferSize()
        Gets amount of memory allocated for a checkpoint temporary buffer.
        Returns:
        Checkpoint page buffer size in bytes or 0 for Ignite to choose the buffer size automatically.
      • setCheckpointPageBufferSize

        public DataRegionConfiguration setCheckpointPageBufferSize​(long checkpointPageBufSize)
        Sets amount of memory allocated for the checkpoint temporary buffer. The buffer is used to create temporary copies of pages that are being written to disk and being update in parallel while the checkpoint is in progress.
        Parameters:
        checkpointPageBufSize - Checkpoint page buffer size in bytes or 0 for Ignite to choose the buffer size automatically.
        Returns:
        this for chaining.
      • isLazyMemoryAllocation

        public boolean isLazyMemoryAllocation()
        Returns:
        True if memory for DataRegion will be allocated only on the creation of the first cache belonged to this DataRegion.
      • setLazyMemoryAllocation

        public DataRegionConfiguration setLazyMemoryAllocation​(boolean lazyMemoryAllocation)
        Sets lazyMemoryAllocation flag value. If true, memory for DataRegion will be allocated only on the creation of the first cache belonged to this DataRegion.
        Parameters:
        lazyMemoryAllocation - Flag value.
        Returns:
        this for chaining.
      • getWarmUpConfiguration

        @Nullable
        public @Nullable WarmUpConfiguration getWarmUpConfiguration()
        Gets warm-up configuration.
        Returns:
        Warm-up configuration.
      • setCdcEnabled

        public DataRegionConfiguration setCdcEnabled​(boolean cdcEnabled)
        Sets flag indicating whether CDC enabled.
        Parameters:
        cdcEnabled - CDC enabled flag.
        Returns:
        this for chaining.
      • isCdcEnabled

        public boolean isCdcEnabled()
        Gets flag indicating whether CDC is enabled. Default value is false.
        Returns:
        CDC enabled flag.