Profiling SAP ISA J2EE WEBAS with Netbeans



Netbeans comes with a very nice profiling tool (memory and CPU), so here we will use it to profile our SAP ISA application.

One drawback is that like most of the new fancy tools, it requires the application to run on java1.5, and SAP wants us to run on 1.4.

Anyhow to be able to profile the App i am running the whole SAP j2ee server under java 1.5 during the profiling session.
This doesn't seem to have any drawback(all works), except the visual administrator as an issue, though i found a fix for that too, see: other_generic_sap_tips

Initial netbeans config / getting the agent string


In Netbeans click profile/attach profiler.
Since it's your first time, it will run you through the wizzard.
profiling/attach2.png

Copy The agent line (step2) on this screen, you will want to copy it, from your Netbeans screen, since you will have to insert it into the configtool so it is used during the SAP J2EE engine startup:
profiling/attach3.png

Telling SAP J2EE engine to run on java 1.5 and start the profiler agent


Using java 1.5


You will want to run the configtool and set the JAVA_HOME to use java1.5 in the instance/dispatcher and server screens.

make sure you set all the JAVA_HOME fields to use java1.5, Be careful to check under each screen TABS
Note, that you might also need to edit your PROFILE to make it use java1.5, example:
/usr/sap/ZTB/SYS/profile/XYZ_JC00_myhost
SAPSYSTEMNAME = XYZ
SAPSYSTEM = 00
INSTANCE_NAME = JC00
DIR_CT_RUN = $(DIR_EXE_ROOT)/run
DIR_EXECUTABLE = $(DIR_INSTANCE)/exe
jstartup/trimming_properties = off
jstartup/protocol = on
#jstartup/vm/home = /usr/lib/j2sdk1.4-sun
############################ HERE - use java 1.5 ######################
jstartup/vm/home = /usr/lib/jvm/java-1.5.0-sun
jstartup/max_caches = 500
jstartup/release = 700
jstartup/instance_properties = $(jstartup/j2ee_properties):$(jstartup/sdm_properties)
j2ee/dbdriver = /sapdb/programs/runtime/jar/sapdbc.jar
igs/listener/rfc/disable = 1
PHYS_MEMSIZE = 512
exe/saposcol = $(DIR_CT_RUN)/saposcol
rsdb/dbid = XYZ
dbs/ada/schema = SAPXYZ


#------------------------------------------------------------
# Jcontrol: Migrated Profile Parameter
#            create at Thu Sep 13 16:14:22 2007
#------------------------------------------------------------
j2ee/instance_id = ID0039456
#------------------------------------------------------------



Having the J2EE call the profiler agent


In configtool, add YOUR agent line (see screenshot):
profiling/config1.png


Now that all your changes are complete, you will need to restart the J2EE engine:
ex: use MMC or stopsap/startssap as SIDadm)

Running a profiling session


Now when starting the j2ee(startsap), the J2EE will start and PAUSE right away, waiting for the profiler to connect.
At this time you should go in Netbeans and go to Profile/Attach debugger, choose a filter and then click "Attach".

First profiling session (first time only)


The first time we need to do a few special things:

Once you go to the "attach" screen:
profiling/attach.png


You will want to create at least one filter, because profiling EVERYTHING is not a good idea, and it will go over the limit of ~65000 instrumented methods, so first create a filter, for example just for your classes or maybe part of sap, say "com.sap.isa.isacore" only for example.
profiling/filters.png


Then you can click attach, note that the very first time you do it, it will complain of the lack of calibration, do as it says and click Profile/Advance commands/Run Profiler Calibration", choose your java install (java 1.5) and let it run it's calibration.
profiling/needcalibration.png

profiling/calibration.png


Once this as completed, you can try attaching the profiler again, only this time it shopuld work.
Click “Profile/Attach Profiler”, pick your filer, and click "attach".

At this point the server will complete it's startup and profile whatever classess match your filter.

You can see the progress/report in the Netbeans profiler view, form there you can clicm the icons and see graphs and data about the profiling sesion.
profiling/view.png


profiling/heap.png


profiling/liveresults.png


JMX issue in visual admin with java 1.5


If you use visual admin with java 1.5, you will have JMX issues, see: other_generic_sap_tips




Last modified: Wed May 14 13:00:12 EDT 2008 by Thibaut Colar