I've been runing two tomcat instances clustered with nginx. On my tomcats I run Infinispan as a distributed cache. When I'm inserting about 4mio records into my cache something strange happens. In picture 1 you can see what I mean. The JVM is allocating more memory than ever needed and won't free after usage.
JVM parameters:
- Xmx8g
- XX:NewRatio=4
- XX:SurvivorRatio=8
- XX:+UseCompressedOops
- XX:+UseConcMarkSweepGC
- XX:+UseParNewGC
- XX:+DisableExplicitGC
- XX:+UseCMSInitiatingOccupancyOnly
- XX:+CMSClassUnloadingEnabled
- XX:+CMSScavengeBeforeRemark
- XX:CMSInitiatingOccupancyFraction=68
- XX:MaxHeapFreeRatio=20
- XX:MinHeapFreeRatio=10
Can you please explain to me why the JVM does not free the allocated memory even though I set the MAXHeapFreeRatio to 20%?