Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VisualVM for profiling an application running on Tomcat

I have apache tomcat 7 running on local and a web application deployed as .war file to this server. I am trying to use visualvm to profile the application but so far I am only able to profile tomcat itself.

I am able to see everything about tomcat in the interface and there are absolutely no problems. I am able to see indvidiual tomcat functions as well which are of no meaning to me.

What I want to see is the execution time of the functions of my deployed web application, in other words my own code. But I am unable to do that? Has anyone ever managed to do this profiling? Do I need to set a JMX connections or something with my deployed application? Below you can find my screen which I am able to profile tomcat functions.

My VisualVM screen which I am able to profile tomcat

like image 998
ralzaul Avatar asked Mar 11 '15 12:03

ralzaul


People also ask

What is VisualVM used for?

Java VisualVM is a tool that provides a visual interface for viewing detailed information about Java applications while they are running on a Java Virtual Machine (JVM), and for troubleshooting and profiling these applications.

What is Profiler in VisualVM?

Java VisualVM enables you to take profiler snapshots to capture the results of a profiling session. A profiler snapshot captures the results at the moment the snapshot is taken. To take a snapshot, click the Take Snapshot of Collected Results button in the toolbar while a profiling session is in progress.

How do I get Java VisualVM?

To install a Java VisualVM plugin: Choose Tools > Plugins from the main menu. In the Available Plugins tab, select the Install checkbox for the plugin. Click Install. Step through and complete the plugin installer.

What is VisualVM executable?

What is VisualVM. It is a tool automatically available after JDK is installed. The executable file could be found on your <JDK installation folder>/bin as displayed below. In order to measure the performance of your application, it is necessary for the application to be recognized by VisualVM first.


1 Answers

You can filter methods displayed in "profiler". but what you want is "sampler".

Here is what you should do.

Before you run sampler. You must check the "settings" checkbox on right of profiling window.

It will show you settings where you can write what packages should be profiled.

for example:

com.myCompany.module.*

profiler

like image 164
MarekM Avatar answered Nov 05 '22 11:11

MarekM