1

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.

Mike W
  • 1,128
  • 1
  • 13
  • 27
  • 1
    What sort of profiling are you after? The more detailed the information, the more invasive the profiler. – skaffman Aug 31 '10 at 20:25

3 Answers3

3

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
  • 73,784
  • 33
  • 194
  • 347
  • This looks interesting, but I need to profile across the network, and it looks like jvisualvm can't do that. – Mike W Sep 01 '10 at 19:28
  • 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 Sep 01 '10 at 19:58
  • 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 Sep 02 '10 at 16:53
  • 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 Sep 02 '10 at 17:08
  • Seen in Netbeans 6.9 it appears to work for Sun based JVM's on Windows, Linux, Solaris and OS X. – Thorbjørn Ravn Andersen Jan 28 '11 at 11:45
1

I prefer Java Flight Recorder. It causes almost no performance overhead and has a nice GUI. Add JVM parameters

-XX:+UnlockCommercialFeatures -XX:+FlightRecorder
-XX:StartFlightRecording=name=test,filename=test.jfr,dumponexit=true 

and open the record with JMC.

jun
  • 51
  • 1
0

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.

Community
  • 1
  • 1
The Alchemist
  • 3,397
  • 21
  • 22
  • 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 Sep 02 '10 at 16:01