Controlling Cache Size

You can control cache size through region size limits, cache size limits, or a combination of the two.

GemFire controls region size by moving least recently used (LRU) entries from the region or from all cache regions.

Controlling Region Size

You can cap the size of any region with the region attribute LruEntriesLimit. You can specify whether to destroy the entries or overflow them to disk in the attribute DiskPolicy. If you overflow entries to disk, you must also specify the attribute PersistenceManager.

Controlling Cache Size

You can control overall cache size with the heap-lru-limit, which is set in gfcpp.properties. This property sets the maximum amount of memory used for the cache, in megabytes. If a new entry causes memory to grow past this limit, GemFire's LRU algorithm is called to evict entries. Heap LRU causes eviction to occur on all regions in the cache, overriding region-level LruEntriesLimit settings when it needs to reclaim memory.

For each region, evictions are performed according to the region's DiskPolicy and PersistenceManager settings. If you use heap-lru-limit, review these region attributes for all your caching regions, to be sure you are evicting the way you want to.

The related heap-lru-delta property, also set in gfcpp.properties, is the amount of memory to free up once the LRU evictions have begun. Memory is reclaimed until the amount of memory used is below heap-lru-limit minus heap-lru-delta.