|Managing Your Data in GemFire XD / Evicting Table Data from Memory|
Use eviction settings to keep your table within a specified limit, either by removing evicted data completely or by creating an overflow table that persists the evicted data to a disk store.
You can configure a global heap and off-heap eviction percentages for all GemFire XD data stores, or configure different heap and off-heap evitction threshold percentages for one or more server groups by using system procedures or by specifying -eviction-heap-percentage or -eviction-offheap-percentage when starting up your server using gfxd. Heap and Off-Heap Eviction, Threshold Configuration Procedures describes how to configure the heap and off-heap eviction percentage using system procedures. See gfxd server for information on using gfxd to start your servers.
Eviction continues until the resource manager calls a halt. GemFire XD evicts the least recently used rows hosted by the member for the table.
If eviction with the DESTROY action is required for dependent tables, consider using a trigger or writer implementation to listen for DELETE events on the parent table. The trigger or writer should fail the DELETE operation if child rows are found to exist in the backend database.
For example, to evict using LRU entry count and overflow evicted rows to a disk store:
CREATE TABLE Orders(OrderId INT NOT NULL,ItemId INT ) EVICTION BY LRUCOUNT 2 EVICTACTION OVERFLOW 'OverflowDiskStore' ASYNCHRONOUS
If you do not specify a disk store, GemFire XD overflows table data to the default disk store.
To create an overflow table and persist the entire table, so that the entire table is available through peer restarts:
CREATE TABLE Orders(OrderId INT NOT NULL,ItemId INT ) EVICTION BY LRUCOUNT 2 EVICTACTION OVERFLOW PERSISTENT 'OverflowDiskStore' ASYNCHRONOUS
The table uses the same named disk store for both overflow and persistence.
To create a table that simply removes evicted data from memory without persisting the evicted data, use the DESTROY eviction action. For example:
CREATE TABLE Orders(OrderId INT NOT NULL,ItemId INT ) EVICTION BY LRUMEMSIZE 1000 EVICTACTION DESTROY