Analyzing Java Heap with IBM Heap Analyzer Tool - Part1

IBM Heap Analyzer tool is an eclipse based tool used to analyze the java heap.
The main aim of this section (part1) of the post is to give you an overall idea about the capabilities of the tool. Before moving into the details of Heap Analyzer tool let us have a brief look at the file naming convention of heap dump.
I am using the file "heapdump.20150617.204848.5220.0005.phd" for analysis and you can see the details of the naming convention in below figure.The last "0005" is sequence number of the file.







Start the Heap Analyzer tool (Details of starting the tools will be covered in the upcoming part of the blog) You can see the Tool versions in the background figure and also in the console.


From file menu open the dump file. While opening you can see the file processing progress, Java Versions,Time stamp of the heap file generation and format of the dump file etc.
Note:- In the console you can see the Java Heap Request of the Heap Analyzer tool.

After loading the heap dump you will get below view in the tool. You can see the loaded heap dump file name, Heap dump information, Tree view of the dump file etc.
Note:- As i have used a clean dump file the "Leak Suspect" will be disabled

Below figure gives you the details of Icons used in "Tree View" of the tool.


In Analysis view you will be able to see the file format, dump file size, Time Stamp, Version of Java and Heap Usage etc.


In Tree View if you select any of the classes, Instance or Array you can see the details of that in the right pan as in the below figure.

The "Analyze" menu option has different kinds of views.

1.) Objects View.

2.) Types View.

3.)Root List.

4.)Root Types View.

As depicted in the below figure you have an option to perform "Gap Analysis" as well. (The topic "Gap Analysis" will be covered in upcoming sections of the post)

You also have different search options available in the Heap Analyzer tool.

As I mentioned initially the main idea of this post is to understand the capabilities of IBM Heap Analyzer Tool. Usage of the tool and other things will be covered in upcoming sections of the post. So keep watching this space. You can specify your mail id in the "Follow by Email" and submit so that you will get a mail alert on the posts.




Setting Java garbage collection policies

Navigate to the JVM which you want to set gc policy as mentioned in below figure.








Enter the gc policy which you want to set in the text field "Generic JVM arguments " 
other gc policies which you can set for JDK 5 are:-
-Xgcpolicy:optthruput
-Xgcpolicy:optavgpause
-Xgcpolicy:subpool

Save and synchronize the change and then restart the JVM (server1).
If you take JVM process status in unix/linux you will be able to see an entry similar to below. Below screen is from a windows javacore dump file.





Enable Tracing for troubleshooting


Navigate to “logging and tracing” and select the JVM, Here I have selected “server1”. Select “Diagnostic trace service”. Select the file radio button so that the trace loges will be logged into the file. Here you can specify maximum number of trace file size and maximum number of historical trace files also. As per below example it generates maximum 5 trace files of 20MB. You have an option to specify the log name and path. Default name is trace.log. after configuring all these select “Change log detail levels” from additional properties.


Note:-  As the JVM server1 is stopped here you can see only “configuration” tab. If it was running you can see “runtime” tab also.














Once you select  “Change log details level” you will get below screen. As I said earlier in notes since JVM (server1) is stopped here also you will get only “configuration’’ tab.
   For enabling component level tracing you can either enter the trace strings in the text box in the below screen or you can expand “All components” and select components so that it appears in the text box.
  The default trace string is “*=info”.




















In Below screen I have entered trace strings to capture traces for security related components.
This will log trace details related to below specified components in “trace.log”.
Note:- Here I have started the JVM hence you can notice an additional tab called “runtime” in the screen shot.  If you specifies the details in “runtime” tab the trace logs will start writing immediately but if you specify it in “configuration” tab you need to synchronise and stop/start the JVM to get the logs. Since we specified the details here in “Configuration” tab we need to sync nodes and restart “server1“.


























Below screen shows the logs directory before setting trace logs.









After syncing nodes and restarting “server1” you can see an additional log called  “trace.log” in the log directory of server1.











Do some security related changes sync/restart if required you can see the specified component traces in trace.log. Below is a snippet from trace.log.

================================================

************ Start Display Current Environment ************
WebSphere Platform 8.0.0.0 [ND 8.0.0.0 n1118.03] running with process name Prasanth-PCCell01\Prasanth-PCNode01\server1 and process id 6484
Host Operating System is Windows 7, version 6.1
Java version = 1.6.0, Java Compiler = j9jit26, Java VM name = IBM J9 VM
was.install.root = D:\IBM\WebSphere\AppServer
user.install.root = D:\IBM\WebSphere\AppServer\profiles\AppSrv01
Java Home = D:\IBM\WebSphere\AppServer\java\jre
ws.ext.dirs = D:\IBM\WebSphere\AppServer/java/lib;D:\IBM\WebSphere\AppServer\profiles\AppSrv01/classes;D:\IBM\WebSphere\AppServer/classes;D:\IBM\WebSphere\AppServer/lib
;D:\IBM\WebSphere\AppServer/installedChannels;D:\IBM\WebSphere\AppServer/lib/ext;D:\IBM\WebSphere\AppServer/web/help;D:\IBM\WebSphere\AppServer/deploytool/itp/plugins/c
om.ibm.etools.ejbdeploy/runtime
Classpath = D:\IBM\WebSphere\AppServer\profiles\AppSrv01/properties;D:\IBM\WebSphere\AppServer/properties;D:\IBM\WebSphere\AppServer/lib/startup.jar;D:\IBM\WebSphere\Ap
pServer/lib/bootstrap.jar;D:\IBM\WebSphere\AppServer/lib/jsf-nls.jar;D:\IBM\WebSphere\AppServer/lib/lmproxy.jar;D:\IBM\WebSphere\AppServer/lib/urlprotocols.jar;D:\IBM\W
ebSphere\AppServer/deploytool/itp/batchboot.jar;D:\IBM\WebSphere\AppServer/deploytool/itp/batch2.jar;D:\IBM\WebSphere\AppServer/java/lib/tools.jar
Java Library path = D:\IBM\WebSphere\AppServer/lib/native/win/x86_64/;D:\IBM\WebSphere\AppServer\java\jre\bin\default;D:\IBM\WebSphere\AppServer\java\jre\bin;.;D:\IBM\W
ebSphere\AppServer\lib\native\win\x86_64;D:\IBM\WebSphere\AppServer\bin;D:\IBM\WebSphere\AppServer\java\bin;D:\IBM\WebSphere\AppServer\java\jre\bin;C:\app\Nithya\produc
t\11.2.0\dbhome_2\bin;C:\app\Nithya\product\11.2.0\dbhome_1\bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsof
t Shared\Windows Live;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Lenovo\Bluetooth Software\;C:
\Program Files\Lenovo\Bluetooth Software\syswow64;C:\Program Files (x86)\Windows Live\Shared;D:\IBM\WebSphere\AppServer\java\jre\bin;
Orb Version = IBM Java ORB build orb626fp1-20110419.00
Current trace specification = *=info:com.ibm.ws.security.*=all:com.ibm.websphere.security.*=all:com.ibm.websphere.wim.*=all:com.ibm.wsspi.wim.*=all:com.ibm.ws.wim.*=all
************* End Display Current Environment *************
[4/8/15 19:14:55:414 IST] 00000000 ManagerAdmin  I   TRAS0018I: The trace state has changed. The new trace state is *=info:com.ibm.ws.security.*=all:com.ibm.websphere.s
ecurity.*=all:com.ibm.websphere.wim.*=all:com.ibm.wsspi.wim.*=all:com.ibm.ws.wim.*=all.
[4/8/15 19:14:55:594 IST] 00000000 ManagerAdmin  A   TRAS0007I: Logging to the service log is disabled
[4/8/15 19:14:55:629 IST] 00000000 ManagerAdmin  I   TRAS0017I: The startup trace state is *=info:com.ibm.ws.security.*=all:com.ibm.websphere.security.*=all:com.ibm.web
sphere.wim.*=all:com.ibm.wsspi.wim.*=all:com.ibm.ws.wim.*=all.
[4/8/15 19:14:55:630 IST] 00000000 ManagerAdmin  I   TRAS0111I: The message IDs that are in use are deprecated
[4/8/15 19:14:55:708 IST] 00000000 ModelMgr      I   WSVR0800I: Initializing core configuration models
[4/8/15 19:14:56:240 IST] 00000000 ComponentMeta I   WSVR0179I: The runtime provisioning feature is disabled. All components will be started.
[4/8/15 19:14:56:350 IST] 00000000 ProviderTrack I com.ibm.ffdc.osgi.ProviderTracker AddingService FFDC1007I: FFDC Provider Installed: com.ibm.ffdc.util.provider.FfdcOn
DirProvider@2194163
[4/8/15 19:14:56:362 IST] 00000000 ProviderTrack I com.ibm.ffdc.osgi.ProviderTracker AddingService FFDC1007I: FFDC Provider Installed: com.ibm.ws.ffdc.impl.FfdcProvider
@219c293
[4/8/15 19:14:56:548 IST] 00000000 RoleBasedAuth >  RoleBasedAuthorizerNullImpl Entry
[4/8/15 19:14:56:549 IST] 00000000 RoleBasedAuth <  RoleBasedAuthorizerNullImpl Exit
[4/8/15 19:14:56:558 IST] 00000000 AdminInitiali A   ADMN0015I: The administration service is initialized.
[4/8/15 19:14:56:768 IST] 00000000 ContextManage >  getInstance Entry
[4/8/15 19:14:56:775 IST] 00000000 ContextManage 3   getInstance SecurityConfigManager instance com.ibm.ws.security.config.SecurityConfigManagerImpl@211e328
[4/8/15 19:14:56:775 IST] 00000000 ContextManage 3   isSingleDomain is true, creating one instance
[4/8/15 19:14:56:775 IST] 00000000 ContextManage >  createInstance Entry
[4/8/15 19:14:56:775 IST] 00000000 ContextManage >  getContextManagerImplFromPluginList Entry
[4/8/15 19:14:56:776 IST] 00000000 ContextManage <  getContextManagerImplFromPluginList Exit
                                 com.ibm.ws.security.auth.ContextManagerImpl
[4/8/15 19:14:56:782 IST] 00000000 ContextManage >  <init> Entry
[4/8/15 19:14:56:797 IST] 00000000 ContextManage <  <init> Exit
[4/8/15 19:14:56:797 IST] 00000000 ContextManage 3   createInstance Loaded ContextManagerImpl class: com.ibm.ws.security.auth.ContextManagerImpl
[4/8/15 19:14:56:798 IST] 00000000 ContextManage >  getContextMgrHandlerImpl Entry
[4/8/15 19:14:56:798 IST] 00000000 ContextManage <  getContextMgrHandlerImpl Exit
                                 <null>
[4/8/15 19:14:56:798 IST] 00000000 ContextManage <  createInstance ContextManagerImpl: 34743925 domainId: null Exit
[4/8/15 19:14:56:798 IST] 00000000 ContextManage >  getInvocationSubject Entry
[4/8/15 19:14:56:807 IST] 00000000 SecurityConfi >  getPropertyBool id=com.ibm.CORBA.delegateBasicAuth default=false  (admin)  Entry
[4/8/15 19:14:56:808 IST] 00000000 SecurityConfi <  getPropertyBool id=com.ibm.CORBA.delegateBasicAuth  (admin)  val=false Exit
[4/8/15 19:14:56:810 IST] 00000000 AdminDataImpl 3   Repository is null.
[4/8/15 19:14:56:811 IST] 00000000 AdminDataImpl 3   CurrentProcessData:

================================================

Hope you enjoyed , Kindly write your suggestions and comments.

Synchronization Settings.















   
1.) Enable service at server startup

This specifies whether the server attempts to start synchronization

2.) Synchronization interval (minutes)

This specifies the number of minutes that elapse between two synchronizations

3.) Automatic synchronization.

Enables/Disables automatic synchronizations. If it is enabled the nodeagent attempts synchronization when it establishes connection with the dmgr and then onwards after every synchronization interval.

4.) Startup synchronization.

Specifies whether nodeagent attempts to synchronize configuration before starting of application servers.

5.) Exclusions.

Specifies files or patterns that should not be part of synchronization The files/patterns specified here will not be copied to nodes during synchronization and it will not be deleted from nodes as well.