Oh java…. what are you doing?

Lots of people complain about java performance (and you know who you are 😉 )

But if you ask them if they’ve actually looked to see what their application is doing many say ‘nope’.  This is of course frustrating for everyone.

Mostly this happens because people just don’t know how to investigate how their application is performing and in the past it’s been difficult to do.  It’s also possible that they’d rather just complain rather than fixing things – much like me previously whinging about the shortcomings of HTML5 😉

However, if you’re running a  JDK (1.5.0+) which implements the Java Management Extensions then you can use tools such as jconsole or jstat to gather information about the execution profile of your application with a goal to correcting any anti-social behaviours.

Let me give you an example of using these tools on a well known Java application – Tomcat.To utilize these tools you have to turn on the management interface which allows the application VM to be monitored from the local network or across the network ( yes, you can secure the management connection )

So, modifying the Tomcat startup to include -Dcom.sun.management.jmxremote – start up Tomcat and then you can use jconsole <pid>  to get a look at what the JVM is doing for your application.

Attached are some pictures. Of course now that you have some better diagnostic data you can try to understand what may be causing it, possibly tune it better, produce better bug reports for the developers or even use them to assist you in fixing the application yourself – it’s ok, you can still say Java sucks but at least now you’ll have some evidence to support you.

snapshot1.png

jconsole window showing some performance statistics.

snapshot2.png

Some basic performance statistics.

snapshot3.png

snapshot4.png

Of course, if you want to collect trending information over a longer period then make sure you have a look at jstat.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s