Profiling SAP ISA J2EE using Eclipse Memory Analyzer
I have another page about using VisualVM which is much more convenient to use.
On the other hand VisualVM requires the SAP engine to run on Java 6.0
, which is not supported by SAP and causes a few issues, so if you want to be safer the method described here might be best (works with JDK 1.4.2)
While this will work with Java 1.4.2, it needs to be at least jdk 126.96.36.199
So, if you are running SAP J2EE with something older than that, you will want to upgrade.
On our 64bit Linux boxes(x86_64) we use the IBM JVM 1.4.2, i was at 14.2.9 so had to upgrade it.
If you have already 188.8.131.52 or better, skip to #Installing Eclipse Memory Analyzer.
Upgrading the JVM to 184.108.40.206
Went to download the special IBM JDK build for SAP here:
and downloaded IBMJava2-SDK-AMD64-1.4.2-13.0.x86_64.tgz
Then I installed it:
sudo tar xzvf /media/sap/sapcd/Others/java_installers/IBM-jvm/IBMJava2-SDK-AMD64-1.4.2-13.0.x86_64.tgz
Make SAP use the new JVM
If your JVM is in a different path than the old version
, you will want to update the the JAVA_HOME entries in the configtool. (I didn't need to do that - path has not changed)
su - ztbadm
And under cluster/instance/*/* set JAVA_HOME to /usr/lib/jvm/IBMJava2-amd64-142/ (in instance & dispatcher & server under ALL tabs
You might also want to update jstartup/vm/home in /usr/sap/ZTB/SYS/profile/ZTB_JC00_host
Then restart the J2ee stopsap & startsap
Installing Eclipse Memory Analyzer
Download the version that matches your OS from IBM:
and extract it somewhere in your home folder ie: /home/thibautc/apps/
IBM JVM add-on
Now because I use an IBM JVM i need a special add-on because IBM dumps are in a different format that Sun's.
If you have a Sun JVM, you can skip this, continue to #Configuring the SAP J2EE engine so it can generate Heap Dumps
Start the Memory Analyzer(MAT) (Make sure your user Java is 1.5 or better to run MAT)
# We give 2GB of memory to mat (it needs lots to parse SAP J2EE dump)
./MemoryAnalyzer -vmargs -Xmx2G
- Download The add-on here:
and save it somewhere (don't extract it)
- In MAT menu click Help / Software Updates / Find and Install.
- Select "Search for new features to install" and click Next.
- Select "New Archived Site" and provide matdtfj.zip then click "Finish".
- Click the checkbox of "matdtfj" and click "Next"
- Accept the license & click "Next"
- click "Finish" and click "Install All" to install it
- When asked to restart MAT, say "Yes".
Configuring the SAP J2EE engine so it can generate Heap Dumps
Use with care, and maybe don't leave on production machine !
Start the configtool
under cluster/instance/server/general add (last)
su - ztbadm
And click Save
Then close the configtool (confirm save/apply when asked)
Restart the engine
: stopsap & startsap
Getting a Heap Dump
Alright, no MAT is ready, we can go get a Heap
To get a useful "realistic" Heap Dump you will probably want your application/website to be used either by real people, or using a load test tool. I usually run the JMeter load tool to simulate lots of traffic on the site.
To request a dump we need to send a SIGQUIT to the J2EE process
To find the process PID you can do
su - ztbadm
ps axf | grep jlaunch | grep std_server
Or use top
to find it.
Now let's request the Heap Dump
Make sure you have disk space avail
~4GB+ or at least 1.5x memory given to J2EE process in configtool, in /usr/sap/ZTB/JC00/j2ee/cluster/server0/
replace 23568 by your actual jlaunch pid found with 'ps'
kill -3 23568 .
A Core file will be written in something like:
When done(~5mn), run jextract on it:
This will create a zip file:
You should remove the dumps from SAP engine path It seems JMAT need the file to be in a folder where it can write to
, so I copy it to my user folder:
cp /usr/sap/ZTB/JC00/j2ee/cluster/server0/core.20090728.122740.16444.0005.dmp.zip /home/tcolar/apps/jmat/
before you forget(large):
Now in JMAT go File/extract dump and select the zip file
It's going to open it (takes about 10mn)
Now you can use JMAT to analyze CPU/Memory:
Memory Analyzer IBM page:
Configuring SAP engine to be able to generate Heap Dumps:
Page on using MAT with an IBM JVM.