views:

64

answers:

2

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.

+1  A: 

Have a look at jvisualvm in the JDK.

It can attach to a running process both locally and also across the network (but with reduced functionality) and allow you to do profiling for both CPU and memory. Have a look at http://blip.tv/file/1582849

Thorbjørn Ravn Andersen
This looks interesting, but I need to profile across the network, and it looks like jvisualvm can't do that.
Mike W
No, but can you run an X server locally (e.g. knoppix in a vmware) then you can run visualvm remotely with a local display.
Thorbjørn Ravn Andersen
You don't even need to do that. Netbeans has VisualVM integrated nicely, and all you need is the Netbeans Remote Profiling pack installed on the machine you wanna profile. NB has a wizard to tell you how to start your remote app (basically add a `-agentpath:file` arg).
The Alchemist
Good to know. I am not intimately familiar with Netbeans. Does the Remote Profiling pack work on non-Sun JVM's?
Thorbjørn Ravn Andersen
A: 

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.

There's some other SO posts on good profiles:

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.

The Alchemist
I'm going to try out Yourkit. Their "early access" builds are free to use, and they seem to have easy support for using a Windows profiling UI connecting to a JVM on a Linux server.
Mike W