Java, JVM and Containers.

Java Server JVM's Always Need To Be Tuned

Jul 29, 2015

If you are running Java on servers or put another way using JavaEE infrastructure and have not tuned your JVM, you are almost certainly under performing or consuming more resources than needed or both. It is now 15 years since I started working on Java based servers via the JRun servlet container, a commercial product which was sunsetted a few years ago. Also I have worked on Tomcat, Websphere and to a lesser extent, Weblogic. All of these containers and more to the point JVM's needed tuning and most of the results of that tuning, the benefits, are quite startling.

Here are two screenshots obtained by analyzing garbage collection logs (GC logs), as a note point, there are two different sets of arguments we can pass to the JVM to
generate GC logs, depending on the JVM version, as follows.

For high update versions of the Oracle 1.7x and the 1.8x JVM we can use these,which will rotate and archive the logs...

So back to the screenshots from the GCViewer utility and these are from client assignments I was called in to help.

In this first case, we see that I would call "thrashing" is the garbage collection activity

In this second case we are seeing horrendously long full garbage collections that large black rectangle is one that lasted 75 seconds. In terms of a Full GC which produces
a "stop the world" event, as all other JVM activity pauses, 75 seconds is a very long time indeed.

So in both these cases, the server overall performance was compromised and as often is the case the client had tried to increase hardware resources either via adding RAM
or even major hardware.

The one thing to bear in mind is that the JVM is literally the heart of all JavaEE equipment and it is literally never tuned adequately "out of the box" because there are
so many pieces of equipment that use the JVM, of all different shapes, sizes, applications etc.