we just had a meeting to address some performance issues in a web application that is used to calculate insurance rates. The calculations are implemented in a C/C++-module, that is used in other software packages as well. To make it available as a webservice, a Java wrapper was implemented that exposes an XML based interface and calls the C/C++-module via JNI.
Measurements showed that several seconds were spent on each calculation inside the Java part. So my first recomodation was to enable garbage collection logging in the VM. We could see at once that many stop-the-world full GCs were made. Talking about that, the developper of the java part told us they did a System.gc()
on several occasions "to make sure the memory is released after use".
OK, I won't elaborate on that statement any further... ;-)
We then added abovementioned -XX:+DisableExplicitGC
too the VMs arguments and reran the tests. This gained about 5 seconds per calculation.
Since we cannot change the code by stripping all those System.gc()
calls at this point in our release process, we are thinking about adding -XX:+DisableExplicitGC
in production until a new Jar can be created.
Now the question is: could there be any risk in doing so? About the only thing I can think of is tomcat using System.gc()
internally when redeploying, but that's just a guess. Are there any other hazards ahead?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…