Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Profiling a J2EE Application

Status
Not open for further replies.

microserf

Programmer
Oct 18, 2005
12
0
0
GB
Hi

How can I profile a J2EE application? Specifically, I want to be able to see which lines of code in my servlets take the most time to execute.

I have seen people suggest adding logging code to do this, but this is messy (adding code that doesn't need to be there) and time-consuming (if I have to edit all my code just to profile, it might be quicker to make 'educated' guesses as to where the bottlenecks are).

I have also seen people suggest using HTTP-based stress testing to identify bottlenecks; however this will only provide a coarse level of granularity (i.e. it will reveal which pages take a long time---I already know this---I want to see which lines of code are slow).

Ideally I'd prefer to avoid commercial solutions.

Thanks!
 
I don't see the point on profiling the code line by line and the only way I see for that is adding code lines with timestamps.

Appart from that, the coarse level is often the only one that will give you any actual performance improvement.

Cheers,
Dian
 
Thanks Dian, but the point of line-by-line profiling is to see which function calls take a long time. An alternative to line-by-line would be to collect profiling data on method calls, but it would be less useful to know that a lot of time is spent in the foo() method than to know that a specific call to foo() takes a long time (particularly if foo() is a standard Java API call rather than one of my algorithms).

While coarse-level profiling will allow me to measure performance improvement, it does not allow one to determine which specific parts of the code need to be optimised---you would still need to make guesses. Ideally you need both.

I have found EJP ( which appears to allow one to profile J2EE applications in a way that is close to what I'm after, so I'll give that a try.

Thanks anyway.
 
Good luck then, but I'd recommend you to measure the performance improvement versus the invested time and I think you will see that profiling single methods or code blocks does not compense.

Cheers,
Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top