Evaluating JVM Heap Dumps

Despite running JVM supposedly being rock-solid and stable I see enough JVM who cant take the load, most likely to non-optimal settings, throwing heap dumps.
A while ago I struggled to open Thread Dumps I can open heap dumps with VisualVM (Version 1.3.7 at the time of writing)

VisualVM

VisualVM

Heap Dump File

Heap Dump File

Beware, with significant heap dump files (in my sample 700MB) it can take quite a while to open or review the results. Open thread dump list took a good 10 minutes.

Long Processing Times

Long Processing Times

Advertisements

Hide Glassfish Server Information

Despite moving on to JBoss progressively I still share my findings, often they apply to other products too.

For a public facing server you want to reveal as little background information as possible. In Glassfish you can hide create custom 404 and 500 error pages (previous post), but you should also hide the server info that comes with the server header, easily revealed by a tool ike the Firefox plugin httpfox.

Response Header

Response Header

There are 2 crucial settings you must change:

  • JVM setting for product name: -Dproduct.name=”My App Server”

    JVM Settings

    JVM Settings

  • Remove the “XPowered By” flag

    XPowered By

    XPowered By

As result you will have a pretty generic response header

Response Header

Response Header

Glassfish Tuning and Thread Dumps

Once you get into a production like stage with more data volume, more users, etc. you will find yourself pretty fast in the situation where Glassfish gets some hickups or slowness. An expected situation if you did not change the default parameters  out of the box which are chosen to make Glassfish to run even on a small box.

We ran into some kind of concurrency problems with JDBC pools and thread where Glassfish appeared to be hanging. One approach is to create thread dumps for the JVM.
With Glassfish we have a few options:

  1. jstack
    Run jps which returns you the list of applications running a JVM, choose the PID and execute
    jstack <PID>
    or jstack -F <PID> > td.log
  2. asadmin
    Go the Glassfish_HOME/bin folder and execute
    ./asadmin --user admin generate-jvm-report --type=thread > threaddump.txt
  3. kill -3 <PID>
    Supposed to create a dump in the default log folder of Glassfish. Doesnt work for me.

With the (or better more than 1) file at hand you can evaluate them by hand or use some of the tools around. I am still struggling to make the tool analyzing my dumps. They simply open the files like a editor.

tda tool

tda tool

Some References

ZK 5.0 released

Finally version 5.0 of the growing popular Ajax-Web-Framework is released. Quite a number of new and updated features certainly drives up the number of users and pushes the community further. Find more information at zkoss.org. As usual the Netbeans plugin will most probably follow in a few days time. Keep you updated.

Netbeans 6.8, Glassfish V3 and JavaEE6 released

The waiting is over, finally we get our hands on a production release of EE6 and Glassfish V3. Last week (Dec 10th) released, you also get it together with Netbeans 6.8. There is lot of attention and coverage on the latest version of the enterprise platform, so I spare you from my personal views,  though I was really looking forward to use it beyond previews and beta’s. I am excited to work with the matured and now “rightsized” framework. Time to get active on writing tutorials and books.

Some useful links with more details: