views:

104

answers:

2
+1  Q: 

Servlet Profiling

What is the best way to undertake Servlet profiling?

In particular I am looking for a solution that can show the execution times of the method calls within the servlet.

I am running the Servlet within a Tomcat environment.

I have tried VisualVM but it only allows me to see the method calls from the Tomcat thread rather than the Servlets themselves.

+1  A: 

I have used JProfiler for profiling, they have support for many different servers and gives very good control and good reports. However it's a commercial application, though you can get an evaluation version. You can take a look at open source profilers as well, though I have not used any of these and can't say how good or bad they are.

Edit I assume you understand how profiling works, the profiler will do some instrumentation and attach an agent to the JVM, all this affects performance. So never ever use it in production environment.

saugata
+1  A: 

Why don't you use JConsole - which exposes MBeans. Your container application will probably expose some useful fields relavent to your servlet - and if it doesn't you can create your own MBeans.

Amir Afghani