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 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.
|
long |
getMetricsRateTimeInterval()
Gets time interval for
DataRegionMetrics.getAllocationRate()
and DataRegionMetrics.getEvictionRate() monitoring purposes. |
int |
getMetricsSubIntervalCount()
Gets a number of sub-intervals the whole
setMetricsRateTimeInterval(long)
will be split into to calculate DataRegionMetrics.getAllocationRate()
and DataRegionMetrics.getEvictionRate() rates (5 by default). |
String |
getName()
Gets data region name.
|
DataPageEvictionMode |
getPageEvictionMode()
Gets memory pages eviction mode.
|
String |
getSwapPath()
A path to the memory-mapped files the memory region defined by this data region will be mapped to.
|
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 |
setMaxSize(long maxSize)
Sets maximum memory region size defined by this data region.
|
DataRegionConfiguration |
setMetricsEnabled(boolean metricsEnabled)
Sets memory metrics enabled flag.
|
DataRegionConfiguration |
setMetricsRateTimeInterval(long metricsRateTimeInterval)
Sets time interval for
DataRegionMetrics.getAllocationRate()
and DataRegionMetrics.getEvictionRate() monitoring purposes. |
DataRegionConfiguration |
setMetricsSubIntervalCount(int metricsSubIntervalCnt)
Sets a number of sub-intervals the whole
setMetricsRateTimeInterval(long) will be split into to calculate
DataRegionMetrics.getAllocationRate() and DataRegionMetrics.getEvictionRate() rates (5 by default). |
DataRegionConfiguration |
setName(String name)
Sets data region name.
|
DataRegionConfiguration |
setPageEvictionMode(DataPageEvictionMode evictionMode)
Sets memory pages eviction mode.
|
DataRegionConfiguration |
setPersistenceEnabled(boolean persistenceEnabled)
Sets persistence enabled flag.
|
DataRegionConfiguration |
setSwapPath(String swapPath)
Sets a path to the memory-mapped files.
|
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 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.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()
.DataPageEvictionMode.DISABLED
used by default.public DataRegionConfiguration setPageEvictionMode(DataPageEvictionMode evictionMode)
evictionMode
- Eviction 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.public long getMetricsRateTimeInterval()
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.
public DataRegionConfiguration setMetricsRateTimeInterval(long metricsRateTimeInterval)
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.public int getMetricsSubIntervalCount()
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.
public DataRegionConfiguration setMetricsSubIntervalCount(int metricsSubIntervalCnt)
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.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.7.2 Release Date : February 6 2019