I see that there are a bunch of "java profiler recommendation" questions that are already answered here. My case is slightly specific, though.
I need to profile a production system that has thousands of live users on it. So I need a lightweight profiler that isn't going to slow the system down to a grinding halt.
I'm running on Tomcat 6.0.29 on JDK 1.6.0_20 on Linux.
My preference would be a free open source profiler. But if there's a commercial one that is clearly the best choice, then that would be fine as well.
Without breaking into a profiler fightout (you can google for that), CPU sampling is generally recognized to one of the least computationally-intensive profiling methods. This is critical if you're profiling an app in production.
Read the following SO post: - Which Java Profiling tool do you use and which tool you think is the best?
You can even just use the JDK and the hprof tools, although even the basic profiler will probably be better.
The trick will be to limit the amount of classes to be profiled, as skafman says.