Why JVM calculated PS Survivor Space size too low for parallel collector

Lokesh Garg picture Lokesh Garg · Apr 5, 2016 · Viewed 12.2k times · Source

I am using JDK1.6.0_16 JVM for the java application that is hosted on an Linux Intel procesor 80 cores machine.

while starting the Java application I have only two options configured -Xms2048m -Xmx8000m in the JVM Options (after java command). I see that PS Old Gen is calculated as 5.21G and PS Eden is calcuated 2.6G but the PS Survivor space is 25MB.

I have exactly same JVM in production and in that PS Survivor Space size is shown as 888MB. I am seeing these sizes in java mission control Memory tab. The cache size (output of /proc/cpuinfo) is showing 24656 in both UAT and production boxes.

Dont think it will make any difference for JVM but still mentioning that the there was very low load on machine at the time of starting JVM.

Can you please advise what parameters does JVM consider for calculating the PS Survivor Space size?

Answer

Peter Lawrey picture Peter Lawrey · Apr 6, 2016

Can you please advise what parameters does JVM consider for calculating the PS Survivor Space size?

It must large enough to never actually fill up after a collection of the Eden space, otherwise you will get Full GCs which is undesirable.

What is an optimal Survivor space size depends on your application. I suggest you test you application under realistic loads with a larger Eden and Survivor space than you imagine useful and see how much of that space ever gets used and add 50% to 100% based on what you see is used.

The machine has 256G of physical memory out of which ~200G

The default heap size is 32 GB and I suggest you use this default unless you have a good reason to reduce it.

-XX:SurvivorRatio=1

This is usually a bad idea and having a high survivor ratio like 8 is usually better.

Setting the value to 8 didnt have any effect

Most likely you have a low allocation rate. I usually set a high Young space, alike -Xmn8g or even -Xmn24g but whether this is a good/bad idea depends on your application.