public final class DataRegionConfiguration extends Object implements Serializable
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>
Modifier and Type | Field and Description |
---|---|
static boolean |
DFLT_METRICS_ENABLED
Default metrics enabled flag.
|
static PageReplacementMode |
DFLT_PAGE_REPLACEMENT_MODE
Default page replacement mode.
|
static int |
DFLT_RATE_TIME_INTERVAL_MILLIS
Default length of interval over which
DataRegionMetrics.getAllocationRate() metric is calculated. |
static int |
DFLT_SUB_INTERVALS
Default amount of sub intervals to calculate
DataRegionMetrics.getAllocationRate() metric. |
Constructor and Description |
---|
DataRegionConfiguration() |
Modifier and Type | Method and Description |
---|---|
long |
getCheckpointPageBufferSize()
Gets amount of memory allocated for a checkpoint temporary buffer.
|
int |
getEmptyPagesPoolSize()
Specifies the minimal number of empty pages to be present in reuse lists for this data region.
|
double |
getEvictionThreshold()
Gets a threshold for memory pages eviction initiation.
|
long |
getInitialSize()
Gets initial memory region size defined by this data region.
|
long |
getMaxSize()
Maximum memory region size defined by this data region.
|
@Nullable MemoryAllocator |
getMemoryAllocator() |
long |
getMetricsRateTimeInterval()
Deprecated.
Use
MetricsMxBean.configureHitRateMetric(String, long) instead. |
int |
getMetricsSubIntervalCount()
Deprecated.
Use
MetricsMxBean.configureHitRateMetric(String, long) instead. |
String |
getName()
Gets data region name.
|
DataPageEvictionMode |
getPageEvictionMode()
Gets memory pages eviction mode.
|
PageReplacementMode |
getPageReplacementMode()
Gets memory pages replacement mode.
|
String |
getSwapPath()
A path to the memory-mapped files the memory region defined by this data region will be mapped to.
|
@Nullable WarmUpConfiguration |
getWarmUpConfiguration()
Gets warm-up configuration.
|
boolean |
isLazyMemoryAllocation() |
boolean |
isMetricsEnabled()
Gets whether memory metrics are enabled by default on node startup.
|
boolean |
isPersistenceEnabled()
Gets whether persistence is enabled for this data region.
|
DataRegionConfiguration |
setCheckpointPageBufferSize(long checkpointPageBufSize)
Sets amount of memory allocated for the checkpoint temporary buffer.
|
DataRegionConfiguration |
setEmptyPagesPoolSize(int emptyPagesPoolSize)
Specifies the minimal number of empty pages to be present in reuse lists for this data region.
|
DataRegionConfiguration |
setEvictionThreshold(double evictionThreshold)
Sets memory pages eviction threshold.
|
DataRegionConfiguration |
setInitialSize(long initSize)
Sets initial memory region size defined by this data region.
|
DataRegionConfiguration |
setLazyMemoryAllocation(boolean lazyMemoryAllocation)
Sets
lazyMemoryAllocation flag value. |
DataRegionConfiguration |
setMaxSize(long maxSize)
Sets maximum memory region size defined by this data region.
|
DataRegionConfiguration |
setMemoryAllocator(MemoryAllocator allocator)
Sets memory allocator.
|
DataRegionConfiguration |
setMetricsEnabled(boolean metricsEnabled)
Sets memory metrics enabled flag.
|
DataRegionConfiguration |
setMetricsRateTimeInterval(long metricsRateTimeInterval)
Deprecated.
Use
MetricsMxBean.configureHitRateMetric(String, long) instead. |
DataRegionConfiguration |
setMetricsSubIntervalCount(int metricsSubIntervalCnt)
Deprecated.
Use
MetricsMxBean.configureHitRateMetric(String, long) instead. |
DataRegionConfiguration |
setName(String name)
Sets data region name.
|
DataRegionConfiguration |
setPageEvictionMode(DataPageEvictionMode evictionMode)
Sets memory pages eviction mode.
|
DataRegionConfiguration |
setPageReplacementMode(PageReplacementMode replacementMode)
Sets memory pages replacement mode.
|
DataRegionConfiguration |
setPersistenceEnabled(boolean persistenceEnabled)
Sets persistence enabled flag.
|
DataRegionConfiguration |
setSwapPath(String swapPath)
Sets a path to the memory-mapped files.
|
DataRegionConfiguration |
setWarmUpConfiguration(@Nullable WarmUpConfiguration warmUpCfg)
Sets warm-up configuration.
|
String |
toString() |
public static final boolean DFLT_METRICS_ENABLED
public static final int DFLT_SUB_INTERVALS
DataRegionMetrics.getAllocationRate()
metric.public static final int DFLT_RATE_TIME_INTERVAL_MILLIS
DataRegionMetrics.getAllocationRate()
metric is calculated.public static final PageReplacementMode DFLT_PAGE_REPLACEMENT_MODE
public String getName()
public DataRegionConfiguration setName(String name)
DataStorageConfiguration.DFLT_DATA_REG_DEFAULT_NAME
value is used.name
- Data region name.this
for chaining.public long getMaxSize()
public DataRegionConfiguration setMaxSize(long maxSize)
maxSize
- Maximum data region size in bytes.this
for chaining.public long getInitialSize()
public DataRegionConfiguration setInitialSize(long initSize)
initSize
- Data region initial size.this
for chaining.public String getSwapPath()
null
if this feature is not used for the memory region
defined by this data region.public DataRegionConfiguration setSwapPath(String swapPath)
swapPath
- A Path to the memory mapped file.this
for chaining.@Nullable public @Nullable MemoryAllocator getMemoryAllocator()
public DataRegionConfiguration setMemoryAllocator(MemoryAllocator allocator)
Unsafe
allocator will be used.allocator
- Memory allocator instance.this
for chaining.public DataPageEvictionMode getPageEvictionMode()
DataPageEvictionMode.DISABLED
is used (default) then an out of
memory exception will be thrown if the memory region usage, defined by this data region, goes beyond its
capacity which is getMaxSize()
.
Note: Page eviction is used only when persistence is disabled for data region. For persistent data regions see
page replacement mode (getPageReplacementMode()
).DataPageEvictionMode.DISABLED
used by default.public DataRegionConfiguration setPageEvictionMode(DataPageEvictionMode evictionMode)
evictionMode
- Eviction mode.this
for chaining.public PageReplacementMode getPageReplacementMode()
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()
).PageReplacementMode.CLOCK
used by default.public DataRegionConfiguration setPageReplacementMode(PageReplacementMode replacementMode)
replacementMode
- Page replacement mode.this
for chaining.public double getEvictionThreshold()
public DataRegionConfiguration setEvictionThreshold(double evictionThreshold)
evictionThreshold
- Eviction threshold.this
for chaining.public int getEmptyPagesPoolSize()
IgniteOutOfMemoryException
occurred with enabled page eviction.public DataRegionConfiguration setEmptyPagesPoolSize(int emptyPagesPoolSize)
IgniteOutOfMemoryException
occurred with enabled page eviction.emptyPagesPoolSize
- Empty pages pool size.this
for chaining.public boolean isMetricsEnabled()
MX bean
.public DataRegionConfiguration setMetricsEnabled(boolean metricsEnabled)
true
, metrics will be enabled on node startup.
Memory metrics can be enabled and disabled at runtime via memory metrics MX bean
.metricsEnabled
- Metrics enabled flag.this
for chaining.public boolean isPersistenceEnabled()
public DataRegionConfiguration setPersistenceEnabled(boolean persistenceEnabled)
persistenceEnabled
- Persistence enabled flag.this
for chaining.@Deprecated public long getMetricsRateTimeInterval()
MetricsMxBean.configureHitRateMetric(String, long)
instead.DataRegionMetrics.getAllocationRate()
and DataRegionMetrics.getEvictionRate()
monitoring purposes.
For instance, after setting the interval to 60_000 milliseconds,
subsequent calls to DataRegionMetrics.getAllocationRate()
will return average allocation rate (pages per second) for the last minute.
@Deprecated public DataRegionConfiguration setMetricsRateTimeInterval(long metricsRateTimeInterval)
MetricsMxBean.configureHitRateMetric(String, long)
instead.DataRegionMetrics.getAllocationRate()
and DataRegionMetrics.getEvictionRate()
monitoring purposes.
For instance, after setting the interval to 60 seconds,
subsequent calls to DataRegionMetrics.getAllocationRate()
will return average allocation rate (pages per second) for the last minute.
metricsRateTimeInterval
- Time interval used for allocation and eviction rates calculations.this
for chaining.@Deprecated public int getMetricsSubIntervalCount()
MetricsMxBean.configureHitRateMetric(String, long)
instead.setMetricsRateTimeInterval(long)
will be split into to calculate DataRegionMetrics.getAllocationRate()
and DataRegionMetrics.getEvictionRate()
rates (5 by default).
Setting it to a bigger value will result in more precise calculation and smaller drops of
DataRegionMetrics.getAllocationRate()
metric when next sub-interval has to be recycled but introduces bigger
calculation overhead.
@Deprecated public DataRegionConfiguration setMetricsSubIntervalCount(int metricsSubIntervalCnt)
MetricsMxBean.configureHitRateMetric(String, long)
instead.setMetricsRateTimeInterval(long)
will be split into to calculate
DataRegionMetrics.getAllocationRate()
and DataRegionMetrics.getEvictionRate()
rates (5 by default).
Setting it to a bigger value will result in more precise calculation and smaller drops of
DataRegionMetrics.getAllocationRate()
metric when next sub-interval has to be recycled but introduces bigger
calculation overhead.
metricsSubIntervalCnt
- A number of sub-intervals.this
for chaining.public long getCheckpointPageBufferSize()
0
for Ignite
to choose the buffer size automatically.public DataRegionConfiguration setCheckpointPageBufferSize(long checkpointPageBufSize)
checkpointPageBufSize
- Checkpoint page buffer size in bytes or 0
for Ignite to
choose the buffer size automatically.this
for chaining.public boolean isLazyMemoryAllocation()
True
if memory for DataRegion
will be allocated only on the creation of the first cache
belonged to this DataRegion
.public DataRegionConfiguration setLazyMemoryAllocation(boolean lazyMemoryAllocation)
lazyMemoryAllocation
flag value.
If true
, memory for DataRegion
will be allocated only on the creation of the first cache
belonged to this DataRegion
.lazyMemoryAllocation
- Flag value.this
for chaining.public DataRegionConfiguration setWarmUpConfiguration(@Nullable @Nullable WarmUpConfiguration warmUpCfg)
warmUpCfg
- Warm-up configuration. Can be null
(default
DataStorageConfiguration.getDefaultWarmUpConfiguration()
will be used).this
for chaining.@Nullable public @Nullable WarmUpConfiguration getWarmUpConfiguration()
GridGain In-Memory Computing Platform : ver. 8.9.14 Release Date : November 5 2024