A GemFire cluster experiences high memory utilization where the Linux meminfo report shows a large volume of AnonPages (Anonymous Pages). This often occurs on nodes running multiple GemFire servers, leading to concerns about memory leaks or misconfiguration even when JVM heap usage appears stable.
Symptoms:
cat /proc/meminfo shows AnonPages value nearly matching the combined maximum heap (-Xmx) settings of all running JVMs.free -h command indicates "used" memory is significantly higher than the actual data stored in GemFire.Anonymous memory (AnonPages) represents memory that is not backed by a file on disk. In a GemFire/Java environment, the entire JVM heap is accounted for as anonymous pages. If multiple servers are configured on a single node (e.g., two servers with 25GB -Xmx on a 64GB node), the OS will report approximately 50GB of AnonPages as the JVMs reserve and consume that address space
The observed AnonPages utilization is expected behavior for JVM-based applications. To manage heap pressure and prevent system instability, follow these configuration steps:
Configure Resource Manager Thresholds: Use GemFire's Resource Manager to set boundaries for heap usage. This prevents the JVM from reaching a state that causes OutOfMemoryError or system swapping.
eviction-heap-percentage: Set this to trigger data removal (e.g., 80%) before the heap is full.critical-heap-percentage: Set this (e.g., 90%) to reject new operations when the heap is dangerously high.Optimize for ZGC (Java 17+): If using the Z Garbage Collector (ZGC), standard "tenured" metrics may not be reliable for eviction.
SoftMaxHeapSize on the server side to give the Resource Manager a more accurate signal.eviction-threshold approximately 3-5% above the SoftMaxHeapSize. Sizing Guidelines: Ensure the sum of all -Xmx settings on a node does not exceed 80-90% of physical RAM to allow for OS overhead, GemFire off-heap tracking, and stack memory