Best and safest Java Profiler for production use? [closed]

I'm looking for a Java Profiler for use in a very high demand production environment, either commercial or free, that meets all of the following requirements:

  • Lightweight integration with code (no recompile with special options, no code hooks, etc). Dropping some profiler specific .jars alongside the application code is ok.
  • Should be able to connect/disconnect to the JVM without restarting the application.
  • When profiling is not active, no impact to performance
  • When profiling is active, negligible impact to performance. Very slight degradation is acceptable.
  • Must do all the 'expected' stuff a profiler does - time spent in each method to find hotspots, object allocation/memory profiling, etc.

Essentially I need something that can sit dormant in production when everything is fine without anyone knowing or caring that it is there, but then be able to connect to it hassle (and performance degradation) free to pinpoint the hard to find problems like hotspots and synchronization issues.


Solution 1:

Have you tried YourKit? It has almost all of the features you are looking for.

Solution 2:

Java VisualVM is a tool that provides a visual interface for viewing detailed information about Java technology-based applications (Java applications) while they are running on a Java Virtual Machine (JVM). Java VisualVM organizes JVM data that is retrieved by the Java Development Kit (JDK) tools and presents the information in a way that enables you to quickly view data on multiple Java applications. You can view data on local applications and applications that are running on remote hosts. You can also capture data about the JVM software and save the data to your local system, and view the data later or share the data with others. This comes with Oracle JDK it self...

$ jvisualvm 

Solution 3:

I have been happy with jProfiler.

Solution 4:

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.