Thursday, June 30, 2011

Get/Analyze the IBM JDK Heap DUMP

Was recently trying to do something that's suppose to be really simple but again was not... Looks like another case of set of engineers having strong "I did it my way.." syndrome. + The great IBM tools which are really strong but its easier to find your kid in a local fest than finding the help for IBM products. After looking through several web pages and sites (some of them even gave wrong/outdated information) I was able to do it. At one point I felt like I am getting clue from one page just to get redirected to another :), anyways enough of my frustration and required steps are given below:

1.     Get the DUMP for IBM JDK
Use the -Xdump argument on the command line or in the Eclipse run configuration. You can have multiple -Xdump stanzas on the command line and also multiple dump types driven by one or multiple events. Thus, -Xdump:heap+java:events=vmstart+vmstop would create a dump agent that would drive both heap and Java™ dump production when either a vmstart or vmstop event was encountered.

a)  Execute the program with the argument -Xdump:heap:events=vmstop
b)  Once the program starts stop/close  it. On Eclipse/Windows Console you will see something like this:

JVMDUMP006I Processing dump event "vmstop", detail "#00000000" - please wait.
JVMDUMP032I JVM requested Heap dump using 'C:\Program Files\MyProduct\heapdump.20110630.133125.776.0001.phd' in response to an event
JVMDUMP010I Heap dump written to C:\Program Files\MyProduct\heapdump.20110630.133125.776.0001.phd
JVMDUMP013I Processed dump event "vmstop", detail "#00000000".

2.     Install the Heap dump analysis tool
a)      If you don't already have the Support Assistant Workbench, download and install the IBM Support Assistant Workbench.
b)      From the Support Assistant Workbench, click Update > Find New... > Tools Add-ons.
c)       In the window that pops up, select the tools that you would like to install and follow the on-screen instructions to complete the installation. When the installation is completed, the Workbench will restart.
List of tools that you can install are given below, but I couldn’t find any so I installed the one which looked familiar. Important one that I think will do the job is HeapAnalyzer
§ IBM Monitoring and Diagnostic Tools for Java - Dump Analyzer
§ IBM Monitoring and Diagnostic Tools for Java - Garbage Collection and Memory Visualizer (GCMV)
§ IBM Monitoring and Diagnostic Tools for Java - Memory Analyzer
§ IBM Monitoring and Diagnostic Tools for Java - Health Center
§ IBM Thread and Monitor Dump Analyzer for Java (TMDA)
§ Multicore Software Development Kit for Java (MSDK)
§ HeapAnalyzer
§ IBM Pattern Modeling and Analysis Tool for Java Garbage Collector (PMAT)
§ Performance Analysis Tool for Java

3.     Starting Heap Analyzer
ISA Version 4:
  1. Select Analyze Problem from the Welcome tab on the home page.
  2. Open the Tools tab.
  3. Select HeapAnalyzer
  4. Once started Open the dump file created in first step
Another tool that’s mentioned on the site is Memory Dump Diagnostic for Java (MDD4J) but couldn’t find it

Sunday, June 19, 2011

more tools, less work

Recently read the article Are Java and .Net becoming legacy platforms?. Though don’t agree to the title of the article but I do agree with the discussion that the author brings up. With so many new languages sprawling up you kind of feel that Java is one of the older members.

Also with recent ‘Oracle Java mess’ I can understand why companies like Google are coming up with their own development platform.

But beside that, in terms of features does the world need so many dev tools. One of the discussion points in the article was the absence of closures in Java. But, come on; are these so important to make Java incomplete? And the security updates, which software does not have those. There can be reasons surrounding the politics but not the overall features. You can hate the process (aka JCP) but don’t hate the language and at-least not for the wrong reasons.

Java is fulfilling the purpose since so many years; I haven’t seen any practical situation where Java was a blocker in any software project I worked on. And how many new languages can you remember have actually made their mark in last 15 years - Ruby, even with a wild guess you will realize that hundreds of other attempts ate dust and god knows what happened to the product managers who started writing their code using those new tools.

I think the problem with so many new upcoming languages is more to do with “I want to do it my way”. This is very simmilar to ‘teenage mindset’ where you just want to show off your new language skills just like a new Apple gadget. And this mindset is somehow encroaching into the head of some senior developers. Learning new things is not bad but when you are working on Enterprise software, it’s all about developing new features and develop fast. You can’t simply put that limited time in trying out new things especially when the existing ones are working fine. And why not simply use that extra time in making existing things better. Say, checking out the existing code for anomalies creeping into your product since 10+ year.  Refer my previous blog:  Mumbai Vs Software architecture ...

In nut shell, at the end of the day I will like to see 95 products in 5 languages rather than 5 products in 95 languages.