|
GemFire 7.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.gemstone.gemfire.cache.EvictionAttributes
public abstract class EvictionAttributes
Attributes that describe how a Region's size is managed through an eviction controller. Eviction
controllers are defined by an EvictionAlgorithm and a EvictionAction. Once a Region is created with an eviction controller, it can
not be removed, however it can be changed through an EvictionAttributesMutator.
AttributesFactory.setEvictionAttributes(EvictionAttributes),
AttributesMutator,
Serialized Form| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.gemstone.gemfire.DataSerializable |
|---|
DataSerializable.Replaceable |
| Constructor Summary | |
|---|---|
EvictionAttributes()
|
|
| Method Summary | |
|---|---|
static EvictionAttributes |
createLIFOEntryAttributes(int maximumEntries,
EvictionAction evictionAction)
|
static EvictionAttributes |
createLIFOMemoryAttributes(int maximumMegabytes,
EvictionAction evictionAction)
|
static EvictionAttributes |
createLRUEntryAttributes()
Creates the EvictionAttributes for an eviction controller that will remove the least recently used (LRU)
entry from a region once the region reaches a certain capacity. |
static EvictionAttributes |
createLRUEntryAttributes(int maximumEntries)
Create attributes to remove the least recently used entries when the maximum number of entries exists in the Region |
static EvictionAttributes |
createLRUEntryAttributes(int maximumEntries,
EvictionAction evictionAction)
Create attributes to perform the given action when the maximum number of entries exists in the Region |
static EvictionAttributes |
createLRUHeapAttributes()
Create EvictionAttributes for evicting the least recently used Region.Entry when heap usage exceeds the
ResourceManager eviction heap threshold. |
static EvictionAttributes |
createLRUHeapAttributes(ObjectSizer sizer)
Creates EvictionAttributes for evicting the least recently used Region.Entry when heap usage exceeds the
ResourceManager critical heap threshold. |
static EvictionAttributes |
createLRUHeapAttributes(ObjectSizer sizer,
EvictionAction evictionAction)
Creates EvictionAttributes for evicting the least recently used Region.Entry when heap usage exceeds the
ResourceManager critical heap threshold. |
static EvictionAttributes |
createLRUMemoryAttributes()
Creates EvictionAttributes for an eviction controller that will remove the least recently used (LRU) entry from a region once the region reaches a certain byte capacity. |
static EvictionAttributes |
createLRUMemoryAttributes(int maximumMegabytes)
Creates EvictionAttributes for an eviction controller that will remove the least recently used (LRU) entry from a region once the region reaches the given maximum capacity. |
static EvictionAttributes |
createLRUMemoryAttributes(int maximumMegabytes,
ObjectSizer sizer)
Creates EvictionAttributes for an eviction controller that will remove the least recently used (LRU) entry from a region once the region reaches the given maximum capacity. |
static EvictionAttributes |
createLRUMemoryAttributes(int maximumMegabytes,
ObjectSizer sizer,
EvictionAction evictionAction)
Creates EvictionAttributes for an eviction controller that will remove the least recently used (LRU) entry from a region once the region reaches the given maximum capacity. |
static EvictionAttributes |
createLRUMemoryAttributes(ObjectSizer sizer)
Creates EvictionAttributes for an eviction controller that will remove the least recently used (LRU) entry from a region once the region reaches the given maximum capacity. |
static EvictionAttributes |
createLRUMemoryAttributes(ObjectSizer sizer,
EvictionAction evictionAction)
Creates EvictionAttributes for an eviction controller that will remove the least recently used (LRU) entry from a region once the region reaches the given maximum capacity. |
boolean |
equals(Object obj)
|
abstract EvictionAction |
getAction()
|
abstract EvictionAlgorithm |
getAlgorithm()
The algorithm is used to identify entries that will be evicited. |
abstract int |
getMaximum()
The unit of this value is determined by the definition of the EvictionAlgorithm set by one of the creation
methods e.g. |
abstract ObjectSizer |
getObjectSizer()
An ObjectSizer is used by the EvictionAlgorithm.LRU_MEMORY algorithm to measure the size of each
Entry as it is entered into a Region. |
int |
hashCode()
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.gemstone.gemfire.DataSerializable |
|---|
fromData, toData |
| Constructor Detail |
|---|
public EvictionAttributes()
| Method Detail |
|---|
public static EvictionAttributes createLRUEntryAttributes()
EvictionAttributes for an eviction controller that will remove the least recently used (LRU)
entry from a region once the region reaches a certain capacity. The entry is either locally destroyed or overflows
to disk when evicted by the eviction controller.
This is not supported when replication is enabled.
For a region with DataPolicy.PARTITION, the EvictionAttribute maximum, indicates number of
entries allowed in the region, collectively for its primary buckets and redundant copies for this VM. Once there
are maximum entries in the region's primary buckets and redundant copies for this VM, the least
recently used entry will be evicted from the bucket in which the subsequent put takes place.
If you are using a cache.xml file to create a Cache Region declaratively, you can include the
following to create an LRU entry eviction controller
<region-attributes>
<eviction-attributes>
<lru-entry-count maximum="1000" action="overflow-to-disk"/>
</eviction-attributes>
</region-attributes>
public static EvictionAttributes createLRUEntryAttributes(int maximumEntries)
maximumEntries - the number of entries to keep in the Region
createLRUEntryAttributes()
public static EvictionAttributes createLRUEntryAttributes(int maximumEntries,
EvictionAction evictionAction)
createLRUEntryAttributes()public static EvictionAttributes createLRUHeapAttributes()
Region.Entry when heap usage exceeds the
ResourceManager eviction heap threshold. If the eviction heap threshold is exceeded the least recently used
Region.Entrys are evicted.
With other LRU-based eviction controllers, only cache actions (such as puts and
gets) cause the LRU entry to be evicted. However, because the JVM's heap may be effected
by more than just the GemFire cache operations, a daemon thread will perform the eviction in the event threads are
not using the Region.
When using Heap LRU, the VM must be launched with the -Xmx and -Xms switches set to the
same values. Many virtual machine implementations have additional VM switches to control the behavior of the
garbage collector. We suggest that you investigate tuning the garbage collector when using this type of eviction
controller. A collector that frequently collects is needed to keep our heap usage up to date. In particular, on
the Sun HotSpot VM, the
-XX:+UseConcMarkSweepGC flag needs to be set, and -XX:CMSInitiatingOccupancyFraction=N
should be set with N being a percentage that is less than the ResourceManager eviction heap threshold.
The JRockit VM has similar flags, -Xgc:gencon and -XXgcTrigger:N, which are required if
using this LRU algorithm. Please Note: the JRockit gcTrigger flag is based on heap free, not heap in use like the
GemFire parameter. This means you need to set gcTrigger to 100-N. for example, if your eviction threshold is 30
percent, you will need to set gcTrigger to 70 percent.
On the IBM VM, the flag to get a similar collector is -Xgcpolicy:gencon, but there is no corollary to
the gcTrigger/CMSInitiatingOccupancyFraction flags, so when using this feature with an IBM VM, the heap usage
statistics might lag the true memory usage of the VM, and thresholds may need to be set sufficiently high that the
VM will initiate GC before the thresholds are crossed.
If you are using a cache.xml file to create a Cache Region declaratively, you can include the
following to create an LRU heap eviction controller:
<region-attributes>
<eviction-attributes>
<lru-heap-percentage action="overflow-to-disk"
</eviction-attributes>
</region-attributes>
* This is equivalent to calling createLRUHeapAttributes(
ObjectSizer.DEFAULT)
EvictionAlgorithm.LRU_HEAP and the default heap percentage,
eviction interval and eviction action.public static EvictionAttributes createLRUHeapAttributes(ObjectSizer sizer)
Region.Entry when heap usage exceeds the
ResourceManager critical heap threshold.
sizer - the sizer implementation used to determine how many entries to remove
EvictionAlgorithm.LRU_HEAP and the provided object sizer
and eviction action.createLRUHeapAttributes()
public static EvictionAttributes createLRUHeapAttributes(ObjectSizer sizer,
EvictionAction evictionAction)
Region.Entry when heap usage exceeds the
ResourceManager critical heap threshold.
sizer - the sizer implementation used to determine how many entries to removeevictionAction - the way in which entries should be evicted
EvictionAlgorithm.LRU_HEAP and the provided object sizer
and eviction action.createLRUHeapAttributes()public static EvictionAttributes createLRUMemoryAttributes()
ObjectSizer.
For a region with DataPolicy.PARTITION, the EvictionAttribute maximum, is always equal to
" local max memory " specified for the PartitionAttributes. It signifies the amount of memory allowed in the region, collectively for its primary buckets
and redundant copies for this VM. It can be different for the same region in different VMs.
If you are using a cache.xml file to create a Cache Region declaratively, you can include the
following to create an LRU memory eviction controller:
<region-attributes>
<eviction-attributes>
<lru-memory-size maximum="1000" action="overflow-to-disk">
<class-name>com.foo.MySizer</class-name>
<parameter name="name">
<string>Super Sizer</string>
</parameter>
</lru-memory-size>
</eviction-attributes>
</region-attributes>
public static EvictionAttributes createLRUMemoryAttributes(int maximumMegabytes)
DataPolicy.PARTITION, even if maximumMegabytes are supplied, the EvictionAttribute
maximum, is always set to " local max memory
" specified for the PartitionAttributes.
This is equivalent to calling createLRUMemoryAttributes(maximumMegabytes, ObjectSizer.DEFAULT)
maximumMegabytes - the maximum allowed bytes in the Region
createLRUMemoryAttributes()
public static EvictionAttributes createLRUMemoryAttributes(int maximumMegabytes,
ObjectSizer sizer)
For a region with DataPolicy.PARTITION, even if maximumMegabytes are supplied, the EvictionAttribute
maximum, is always set to " local max
memory " specified for the PartitionAttributes.
maximumMegabytes - the maximum allowed bytes in the Regionsizer - calculates the size in bytes of the key and value for an entry.
createLRUMemoryAttributes()
public static EvictionAttributes createLRUMemoryAttributes(int maximumMegabytes,
ObjectSizer sizer,
EvictionAction evictionAction)
For a region with DataPolicy.PARTITION, even if maximumMegabytes are supplied, the EvictionAttribute
maximum, is always set to " local max
memory " specified for the PartitionAttributes.
maximumMegabytes - the maximum allowed bytes in the Regionsizer - calculates the size in bytes of the key and value for an entry.evictionAction - the action to take when the maximum has been reached.
createLRUMemoryAttributes()public static EvictionAttributes createLRUMemoryAttributes(ObjectSizer sizer)
For a region with DataPolicy.PARTITION, even if maximumMegabytes are supplied, the EvictionAttribute
maximum, is always set to " local max
memory " specified for the PartitionAttributes.
sizer - calculates the size in bytes of the key and value for an entry.
createLRUMemoryAttributes()
public static EvictionAttributes createLRUMemoryAttributes(ObjectSizer sizer,
EvictionAction evictionAction)
For a region with DataPolicy.PARTITION, even if maximumMegabytes are supplied, the EvictionAttribute
maximum, is always set to " local max
memory " specified for the PartitionAttributes.
sizer - calculates the size in bytes of the key and value for an entry.evictionAction - the action to take when the maximum has been reached.
createLRUMemoryAttributes()public abstract ObjectSizer getObjectSizer()
ObjectSizer is used by the EvictionAlgorithm.LRU_MEMORY algorithm to measure the size of each
Entry as it is entered into a Region. A default implementation is provided, see createLRUMemoryAttributes() for more.
EvictionAlgorithm.LRU_MEMORY, for all algorithms null is returned.public abstract EvictionAlgorithm getAlgorithm()
public abstract int getMaximum()
EvictionAlgorithm set by one of the creation
methods e.g. createLRUEntryAttributes()
EvictionAlgorithm which determines when the EvictionAction is
performed.public abstract EvictionAction getAction()
EvictionAlgorithm takes when the maximum value is reached.public final boolean equals(Object obj)
equals in class Objectpublic final int hashCode()
hashCode in class Objectpublic String toString()
toString in class Object
public static EvictionAttributes createLIFOEntryAttributes(int maximumEntries,
EvictionAction evictionAction)
public static EvictionAttributes createLIFOMemoryAttributes(int maximumMegabytes,
EvictionAction evictionAction)
|
GemFire 7.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||