3
votes

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.

Heap Tomcat 1

Heap Tomcat 2

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%?

1

1 Answers

0
votes

You might refer to this SO post to see if the issue noticed here might apply to you, and why you're not seeing your memory freed as expected.

tl;dr version is that it seems people have found that a serial GC configuration is the only one that really pays attention to the min/max heap ratio options, but that may be different for your particular case.

Further reference might shed some light on the behavior of the GC.