Class MemoryPolicyConfiguration
- java.lang.Object
-
- org.apache.ignite.configuration.MemoryPolicyConfiguration
-
- All Implemented Interfaces:
Serializable
@Deprecated public final class MemoryPolicyConfiguration extends Object implements Serializable
Deprecated.UseDataRegionConfigurationinstead.This class allows defining custom memory policies' configurations with various parameters for Apache Ignite page memory (seeMemoryConfiguration. For each configured memory policy Apache Ignite instantiates respective memory regions with different parameters like maximum size, eviction policy, swapping options, etc. An Apache Ignite cache can be mapped to a particular policy usingCacheConfiguration.setMemoryPolicyName(String)method.Sample configuration below shows how to configure several memory policies:
<property name="memoryConfiguration"> <bean class="org.apache.ignite.configuration.MemoryConfiguration"> <property name="defaultMemoryPolicyName" value="Default_Region"/> <property name="pageSize" value="4096"/> <property name="memoryPolicies"> <list> <bean class="org.apache.ignite.configuration.MemoryPolicyConfiguration"> <property name="name" value="Default_Region"/> <property name="initialSize" value="#{100L * 1024 * 1024}"/> </bean> <bean class="org.apache.ignite.configuration.MemoryPolicyConfiguration"> <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.MemoryPolicyConfiguration"> <property name="name" value="25MB_Region_Swapping"/> <property name="initialSize" value="#{25L * 1024 * 1024}"/> <property name="maxSize" value="#{100L * 1024 * 1024}"/> <property name="swapFilePath" value="memoryPolicyExampleSwap"/> </bean> </list> </property>- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static booleanDFLT_METRICS_ENABLEDDeprecated.Default metrics enabled flag.static intDFLT_RATE_TIME_INTERVAL_MILLISDeprecated.Default length of interval over whichMemoryMetrics.getAllocationRate()metric is calculated.static intDFLT_SUB_INTERVALSDeprecated.Default amount of sub intervals to calculateMemoryMetrics.getAllocationRate()metric.
-
Constructor Summary
Constructors Constructor Description MemoryPolicyConfiguration()Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description intgetEmptyPagesPoolSize()Deprecated.Specifies the minimal number of empty pages to be present in reuse lists for this memory policy.doublegetEvictionThreshold()Deprecated.Gets a threshold for memory pages eviction initiation.longgetInitialSize()Deprecated.Gets initial memory region size defined by this memory policy.longgetMaxSize()Deprecated.Maximum memory region size defined by this memory policy.StringgetName()Deprecated.Gets memory policy name.DataPageEvictionModegetPageEvictionMode()Deprecated.Gets memory pages eviction mode.longgetRateTimeInterval()Deprecated.UseMetricsMxBean.configureHitRateMetric(String, long)instead.intgetSubIntervals()Deprecated.UseMetricsMxBean.configureHitRateMetric(String, long)instead.StringgetSwapFilePath()Deprecated.A path to the memory-mapped files the memory region defined by this memory policy will be mapped to.booleanisMetricsEnabled()Deprecated.Gets whether memory metrics are enabled by default on node startup.MemoryPolicyConfigurationsetEmptyPagesPoolSize(int emptyPagesPoolSize)Deprecated.Specifies the minimal number of empty pages to be present in reuse lists for this memory policy.MemoryPolicyConfigurationsetEvictionThreshold(double evictionThreshold)Deprecated.Sets memory pages eviction threshold.MemoryPolicyConfigurationsetInitialSize(long initialSize)Deprecated.Sets initial memory region size defined by this memory policy.MemoryPolicyConfigurationsetMaxSize(long maxSize)Deprecated.Sets maximum memory region size defined by this memory policy.MemoryPolicyConfigurationsetMetricsEnabled(boolean metricsEnabled)Deprecated.Sets memory metrics enabled flag.MemoryPolicyConfigurationsetName(String name)Deprecated.Sets memory policy name.MemoryPolicyConfigurationsetPageEvictionMode(DataPageEvictionMode evictionMode)Deprecated.Sets memory pages eviction mode.MemoryPolicyConfigurationsetRateTimeInterval(long rateTimeInterval)Deprecated.UseMetricsMxBean.configureHitRateMetric(String, long)instead.MemoryPolicyConfigurationsetSubIntervals(int subIntervals)Deprecated.UseMetricsMxBean.configureHitRateMetric(String, long)instead.MemoryPolicyConfigurationsetSwapFilePath(String swapFilePath)Deprecated.Sets a path to the memory-mapped file.StringtoString()Deprecated.
-
-
-
Field Detail
-
DFLT_METRICS_ENABLED
public static final boolean DFLT_METRICS_ENABLED
Deprecated.Default metrics enabled flag.- See Also:
- Constant Field Values
-
DFLT_SUB_INTERVALS
public static final int DFLT_SUB_INTERVALS
Deprecated.Default amount of sub intervals to calculateMemoryMetrics.getAllocationRate()metric.- See Also:
- Constant Field Values
-
DFLT_RATE_TIME_INTERVAL_MILLIS
public static final int DFLT_RATE_TIME_INTERVAL_MILLIS
Deprecated.Default length of interval over whichMemoryMetrics.getAllocationRate()metric is calculated.- See Also:
- Constant Field Values
-
-
Method Detail
-
getName
public String getName()
Deprecated.Gets memory policy name.- Returns:
- Memory policy name.
-
setName
public MemoryPolicyConfiguration setName(String name)
Deprecated.Sets memory policy name. The name must be non empty and must not be equal to the reserved 'sysMemPlc' one. If not specified,MemoryConfiguration.DFLT_MEM_PLC_DEFAULT_NAMEvalue is used.- Parameters:
name- Memory policy name.- Returns:
thisfor chaining.
-
getMaxSize
public long getMaxSize()
Deprecated.Maximum memory region size defined by this memory policy. 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 MemoryPolicyConfiguration setMaxSize(long maxSize)
Deprecated.Sets maximum memory region size defined by this memory policy. The total size should not be less than 10 MB due to the internal data structures overhead.- Parameters:
maxSize- Maximum memory policy size in bytes.- Returns:
thisfor chaining.
-
getInitialSize
public long getInitialSize()
Deprecated.Gets initial memory region size defined by this memory policy. When the used memory size exceeds this value, new chunks of memory will be allocated.- Returns:
- Memory policy start size.
-
setInitialSize
public MemoryPolicyConfiguration setInitialSize(long initialSize)
Deprecated.Sets initial memory region size defined by this memory policy. When the used memory size exceeds this value, new chunks of memory will be allocated.- Parameters:
initialSize- Memory policy initial size.- Returns:
thisfor chaining.
-
getSwapFilePath
public String getSwapFilePath()
Deprecated.A path to the memory-mapped files the memory region defined by this memory policy 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
nullif this feature is not used for the memory region defined by this memory policy.
-
setSwapFilePath
public MemoryPolicyConfiguration setSwapFilePath(String swapFilePath)
Deprecated.Sets a path to the memory-mapped file.- Parameters:
swapFilePath- A Path to the memory mapped file.- Returns:
thisfor chaining.
-
getPageEvictionMode
public DataPageEvictionMode getPageEvictionMode()
Deprecated.Gets memory pages eviction mode. IfDataPageEvictionMode.DISABLEDis used (default) then an out of memory exception will be thrown if the memory region usage, defined by this memory policy, goes beyond its capacity which isgetMaxSize().- Returns:
- Memory pages eviction algorithm.
DataPageEvictionMode.DISABLEDused by default.
-
setPageEvictionMode
public MemoryPolicyConfiguration setPageEvictionMode(DataPageEvictionMode evictionMode)
Deprecated.Sets memory pages eviction mode.- Parameters:
evictionMode- Eviction mode.- Returns:
thisfor chaining.
-
getEvictionThreshold
public double getEvictionThreshold()
Deprecated.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 memory region (defined by this policy) is occupied.- Returns:
- Memory pages eviction threshold.
-
setEvictionThreshold
public MemoryPolicyConfiguration setEvictionThreshold(double evictionThreshold)
Deprecated.Sets memory pages eviction threshold.- Parameters:
evictionThreshold- Eviction threshold.- Returns:
thisfor chaining.
-
getEmptyPagesPoolSize
public int getEmptyPagesPoolSize()
Deprecated.Specifies the minimal number of empty pages to be present in reuse lists for this memory policy. 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 ifIgniteOutOfMemoryExceptionoccurred with enabled page eviction.- Returns:
- Minimum number of empty pages in reuse list.
-
setEmptyPagesPoolSize
public MemoryPolicyConfiguration setEmptyPagesPoolSize(int emptyPagesPoolSize)
Deprecated.Specifies the minimal number of empty pages to be present in reuse lists for this memory policy. 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 ifIgniteOutOfMemoryExceptionoccurred with enabled page eviction.- Parameters:
emptyPagesPoolSize- Empty pages pool size.- Returns:
thisfor chaining.
-
isMetricsEnabled
public boolean isMetricsEnabled()
Deprecated.Gets whether memory metrics are enabled by default on node startup.- Returns:
- Metrics enabled flag.
-
setMetricsEnabled
public MemoryPolicyConfiguration setMetricsEnabled(boolean metricsEnabled)
Deprecated.Sets memory metrics enabled flag. If this flag istrue, metrics will be enabled on node startup.- Parameters:
metricsEnabled- Metrics enabled flag.- Returns:
thisfor chaining.
-
getRateTimeInterval
@Deprecated public long getRateTimeInterval()
Deprecated.UseMetricsMxBean.configureHitRateMetric(String, long)instead.Gets time interval forMemoryMetrics.getAllocationRate()andMemoryMetrics.getEvictionRate()monitoring purposes.For instance, after setting the interval to 60_000 milliseconds, subsequent calls to
MemoryMetrics.getAllocationRate()will return average allocation rate (pages per second) for the last minute.- Returns:
- Time interval over which allocation rate is calculated.
-
setRateTimeInterval
@Deprecated public MemoryPolicyConfiguration setRateTimeInterval(long rateTimeInterval)
Deprecated.UseMetricsMxBean.configureHitRateMetric(String, long)instead.Sets time interval forMemoryMetrics.getAllocationRate()andMemoryMetrics.getEvictionRate()monitoring purposes.For instance, after setting the interval to 60 seconds, subsequent calls to
MemoryMetrics.getAllocationRate()will return average allocation rate (pages per second) for the last minute.- Parameters:
rateTimeInterval- Time interval used for allocation and eviction rates calculations.- Returns:
thisfor chaining.
-
getSubIntervals
@Deprecated public int getSubIntervals()
Deprecated.UseMetricsMxBean.configureHitRateMetric(String, long)instead.Gets a number of sub-intervals the wholesetRateTimeInterval(long)will be split into to calculateMemoryMetrics.getAllocationRate()andMemoryMetrics.getEvictionRate()rates (5 by default).Setting it to a bigger value will result in more precise calculation and smaller drops of
MemoryMetrics.getAllocationRate()metric when next sub-interval has to be recycled but introduces bigger calculation overhead.- Returns:
- number of sub intervals.
-
setSubIntervals
@Deprecated public MemoryPolicyConfiguration setSubIntervals(int subIntervals)
Deprecated.UseMetricsMxBean.configureHitRateMetric(String, long)instead.Sets a number of sub-intervals the wholesetRateTimeInterval(long)will be split into to calculateMemoryMetrics.getAllocationRate()andMemoryMetrics.getEvictionRate()rates (5 by default).Setting it to a bigger value will result in more precise calculation and smaller drops of
MemoryMetrics.getAllocationRate()metric when next sub-interval has to be recycled but introduces bigger calculation overhead.- Parameters:
subIntervals- A number of sub-intervals.- Returns:
thisfor chaining.
-
-