473,786 Members | 2,428 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to find out the most expensive SQLs in J2EE and DB2 environment.

Hello,

I am testing a complex J2EE application on WebSphere and UDB V8.2.3.
Because of the compliexity of the application, we have to run it a few
hours to finish all test scenarios.

One of our test objectives is to identify the top 100 most expensive
SQLs (based on CPU time, the total executive time, and the number of
executions). So I am trying different DB2 monitoring tools, but I can't
get the SQLs that I want. Here is what I tried.

1. Use the event monitor to dump out all SQL statements. But the event
monitor report doesn't provide sorting option to list the expensive
SQLs.

2. Use the snapshot to dump out the SQL statements. Again the snapshot
doesn't provide sorting option. More importantly, snapshot can only
dump out the SQLs in the database package cache (PCKCACHESZ). So I
tried to make the package size as big as possible. However, since the
application needs to run a few hours with different SQLs, there is no
guarantee that all SQLs are in the cache.

3. Tried the Activity monitor (Resolving the performance degradation of
an application). I found that it only shows very limited number of
SQLs. Even if I enlarge the PCKCACHESZ, it doesn't show more SQLs.

Any comment are highly appreciated!

Jason Zhang

Nov 23 '06 #1
5 3654
Jason wrote:
Hello,

I am testing a complex J2EE application on WebSphere and UDB V8.2.3.
Because of the compliexity of the application, we have to run it a few
hours to finish all test scenarios.

One of our test objectives is to identify the top 100 most expensive
SQLs (based on CPU time, the total executive time, and the number of
executions). So I am trying different DB2 monitoring tools, but I can't
get the SQLs that I want. Here is what I tried.

1. Use the event monitor to dump out all SQL statements. But the event
monitor report doesn't provide sorting option to list the expensive
SQLs.

2. Use the snapshot to dump out the SQL statements. Again the snapshot
doesn't provide sorting option. More importantly, snapshot can only
dump out the SQLs in the database package cache (PCKCACHESZ). So I
tried to make the package size as big as possible. However, since the
application needs to run a few hours with different SQLs, there is no
guarantee that all SQLs are in the cache.

3. Tried the Activity monitor (Resolving the performance degradation of
an application). I found that it only shows very limited number of
SQLs. Even if I enlarge the PCKCACHESZ, it doesn't show more SQLs.

Any comment are highly appreciated!

Jason Zhang
Jason,

You probably want a tool to process the event monitor output to provide this
information. We currently use a tool called SQL-Guy, which does an
excellent job of this. The only problem is that the company which supplied
it (DGI) was bought by BMC a couple of years ago and have just announced
that support for this will end with V8.

We are going to look for an alternative, for it is so useful for exactly
what you describe. I know of at least two others tools on the market
which do such a thing, and you may want to look at these -

SQL Sleuth from Martin Hubel Consulting (http://www.mhubel.com)
SpeedGain for DB2 from ITGain (http://www.itgain.de)

HTH

Phil
Nov 23 '06 #2
Philip,

Thank you so much for the advice. I will try the tools that you
mentioned...

Jason

Nov 23 '06 #3

Jason wrote:
Hello,
[...]
>
2. Use the snapshot to dump out the SQL statements. Again the snapshot
doesn't provide sorting option.
You could dump it to a file and sort the file. Here is how I normally
do it:

db=...
dir=`pwd`/snap-${db}-`date +"%Y%m%d_%H%M%S "`
mkdir -p ${dir}

db2 get snapshot for dynamic sql on $db ${dir}/snap.sql

# exec time
rm -f ${dir}/10_worst_total_ exectime_snap.s ql
for g in `grep "Total execution time (sec.ms)" ${dir}/snap.sql | cut
-f2 -d= | s
ort -n | tail -10`; do
grep -B20 -A4 "Total execution time (sec.ms) [ ]* = $g"
${dir}/snap.sql
>${dir}/10_worst_total_ exectime_snap.s ql
done

# number of exec
rm -f ${dir}/10_worst_number _of_exec_snap.s ql
for g in `grep "Number of executions" ${dir}/snap.sql | cut -f2 -d= |
sort -n |
tail -10`; do
,grep -A24 "Number of executions [ ]* = $g" ${dir}/snap.sql >>
${dir}/10_
worst_number_of _exec_snap.sql
done

# sort
rm -f ${dir}/10_worst_sort_s nap.sql
for g in `grep "Statement sorts" ${dir}/snap.sql | cut -f2 -d= | sort
-n | tail
-10`; do
grep -A14 -B9 "Statement sorts [ ]* = $g" ${dir}/snap.sql >>
${dir}/10_w
orst_sort_snap. sql
done
More importantly, snapshot can only
dump out the SQLs in the database package cache (PCKCACHESZ). So I
tried to make the package size as big as possible. However, since the
application needs to run a few hours with different SQLs, there is no
guarantee that all SQLs are in the cache.
True

Main advantage (beside the price :) with a method like the above, is
that you only need an ssh connection to the server to get it up and
running.

/Lennart

Nov 24 '06 #4
Try db2top, this is exactly what it does.
http://www.alphaworks.ibm.com/tech/db2top

Lennart a écrit :
Jason wrote:
Hello,
[...]

2. Use the snapshot to dump out the SQL statements. Again the snapshot
doesn't provide sorting option.

You could dump it to a file and sort the file. Here is how I normally
do it:

db=...
dir=`pwd`/snap-${db}-`date +"%Y%m%d_%H%M%S "`
mkdir -p ${dir}

db2 get snapshot for dynamic sql on $db ${dir}/snap.sql

# exec time
rm -f ${dir}/10_worst_total_ exectime_snap.s ql
for g in `grep "Total execution time (sec.ms)" ${dir}/snap.sql | cut
-f2 -d= | s
ort -n | tail -10`; do
grep -B20 -A4 "Total execution time (sec.ms) [ ]* = $g"
${dir}/snap.sql
${dir}/10_worst_total_ exectime_snap.s ql
done

# number of exec
rm -f ${dir}/10_worst_number _of_exec_snap.s ql
for g in `grep "Number of executions" ${dir}/snap.sql | cut -f2 -d= |
sort -n |
tail -10`; do
,grep -A24 "Number of executions [ ]* = $g" ${dir}/snap.sql >>
${dir}/10_
worst_number_of _exec_snap.sql
done

# sort
rm -f ${dir}/10_worst_sort_s nap.sql
for g in `grep "Statement sorts" ${dir}/snap.sql | cut -f2 -d= | sort
-n | tail
-10`; do
grep -A14 -B9 "Statement sorts [ ]* = $g" ${dir}/snap.sql >>
${dir}/10_w
orst_sort_snap. sql
done
More importantly, snapshot can only
dump out the SQLs in the database package cache (PCKCACHESZ). So I
tried to make the package size as big as possible. However, since the
application needs to run a few hours with different SQLs, there is no
guarantee that all SQLs are in the cache.

True

Main advantage (beside the price :) with a method like the above, is
that you only need an ssh connection to the server to get it up and
running.

/Lennart
Nov 24 '06 #5

jacques wrote:
Try db2top, this is exactly what it does.
http://www.alphaworks.ibm.com/tech/db2top
I havent seen this one before. I'll give it a try right away.
Thanx
/Lennart

Lennart a écrit :
Jason wrote:
Hello,
[...]
>
2. Use the snapshot to dump out the SQL statements. Again the snapshot
doesn't provide sorting option.
You could dump it to a file and sort the file. Here is how I normally
do it:

db=...
dir=`pwd`/snap-${db}-`date +"%Y%m%d_%H%M%S "`
mkdir -p ${dir}

db2 get snapshot for dynamic sql on $db ${dir}/snap.sql

# exec time
rm -f ${dir}/10_worst_total_ exectime_snap.s ql
for g in `grep "Total execution time (sec.ms)" ${dir}/snap.sql | cut
-f2 -d= | s
ort -n | tail -10`; do
grep -B20 -A4 "Total execution time (sec.ms) [ ]* = $g"
${dir}/snap.sql
>${dir}/10_worst_total_ exectime_snap.s ql
done

# number of exec
rm -f ${dir}/10_worst_number _of_exec_snap.s ql
for g in `grep "Number of executions" ${dir}/snap.sql | cut -f2 -d= |
sort -n |
tail -10`; do
,grep -A24 "Number of executions [ ]* = $g" ${dir}/snap.sql >>
${dir}/10_
worst_number_of _exec_snap.sql
done

# sort
rm -f ${dir}/10_worst_sort_s nap.sql
for g in `grep "Statement sorts" ${dir}/snap.sql | cut -f2 -d= | sort
-n | tail
-10`; do
grep -A14 -B9 "Statement sorts [ ]* = $g" ${dir}/snap.sql >>
${dir}/10_w
orst_sort_snap. sql
done
More importantly, snapshot can only
dump out the SQLs in the database package cache (PCKCACHESZ). So I
tried to make the package size as big as possible. However, since the
application needs to run a few hours with different SQLs, there is no
guarantee that all SQLs are in the cache.
>
True

Main advantage (beside the price :) with a method like the above, is
that you only need an ssh connection to the server to get it up and
running.



/Lennart
Nov 24 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2068
by: Dom Incolingo | last post by:
Hello, I am trying to install version 1.4 of the J2EE on Linux (SuSE 9.0), but the install process fails. I downloaded the install file (j2eesdk-1_4-dr-linux-eval) from Sun, added execute permissions (chmod +x j2eesdk-1_4-dr-linux-eval), and tried to execute this install file. The install process logs messages that say it is "Checking available disk space", "Checking Java(TM) 2 Runtime Environment", "Extracting Java(TM) 2 Runtime...
15
7699
by: Herman | last post by:
Hi everyone, I'm currently studying for my Master's in Computer Science, and I will be working on my thesis this summer. I've been thinking about constructing a web services application for my thesis, as I've been interested in this technology, and I haven't had a chance to work with it in my last job. The issue is what platform to use: ..NET or J2EE? Prior to starting my MSc course, I worked for a software developer for five years...
0
2026
by: Jim Collins | last post by:
This position requires that you be a U.S. citizen and hold an active SSBI clearance. This position offers highly competitive compensation with excellent benefits in a highly professional work environment. We respect and appreciate technical ability and reward outstanding performance with recognition and tangible awards. Please reply with "J2EE Architect" in the subject line of your email. Email your resume to jimcollins at gmail.com ...
13
1588
by: Jonathan Li | last post by:
Hi there, I posted a thread in another group. I could not get satisfactory feedback. I would like to try if anybody in this group can help me out. My plan was, to develop components at server side (something like EJBs). For data entry and operation application functions, I can use C#.Net. For reporting and enquiry functions, I can use ASP.Net. You may aware that these two packages have a lot in common. Under J2EE environment, I know...
7
8570
by: Luca | last post by:
I am not a programmer but I do work in the ICT sector. I read somewhere that J2EE would be "dying" and that PHP would be taking its place soon... Is this complete crap or does it have some real base ? Regards
3
6627
dmjpro
by: dmjpro | last post by:
plz send me a good link which can clearify me how the J2EE framework works i want the details information .... plz help thanx
0
1104
by: stmfc | last post by:
I am very new to j2ee applications and i need some help to set up my environment. I have some questions: 1-Can i use classical eclipse by adding j2ee.jar to the classpath to create dynamic web application? 2-Are classical eclipse and eclipse web tool related to each other and working together, or are they totally seperate IDEs ? 3- if i am using Eclipse Web Tools IDE, then do i have to do any arrangement related with j2ee.jar or any...
0
9492
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10163
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10108
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9960
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5532
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4064
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3668
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.