Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to profile a headless Java application, running remotely?

I have a headless Java application, running on a remote server as a daemon-style process.

I want to extract Java level profiling information from the process, of the sort displayed by JVisualVM. For example, it should show method invocation times and so on.

What is the best way of doing this? My understanding is that JVisualVM does not profile when connecting remotely.

Ideally, the profiling information would be stored in a file for later inspection, in a manner similar to Java heap generation (with jmap) and later analysis (with a heap inspector).

like image 518
Dan Gravell Avatar asked Nov 04 '22 12:11

Dan Gravell


1 Answers

You can use NetBeans profiler remote profiling capability.

Remote Profiling

Profile an application that is running on a different system than your NetBeans IDE. The profiler's remote pack can be installed on a remote system, allowing you to profile an application that is started on that system.

In fact, VisualVM is based on it.

Beside various monitoring features, the tool contains a built-in profiler based on the NetBeans profiler. While the profiler UI in VisualVM looks simple (especially when compared to the NetBeans profiler), the profiling capabilities are almost as powerful as in NetBeans.

Here is a detailed blog post about Profiling a Java remote server using Netbeans.

like image 141
fglez Avatar answered Nov 09 '22 10:11

fglez