Profiling an application with JProfiler Tool

3 Mar

JProfiler’s interface is user friendly and very fast in achieving the goal that came from the need to use an analyzing tool, which is, to show the performance statistics about the selected application and the possible leaks.

JProfiler offers two different kinds of sessions:

Local sessions which allow you to assemble the information required to start and profile your application in a point and click interface.
Remote sessions which allow you to attach to any externally started Java application, even on a different computer. This type of session can be used to profile virtually any Java application server.

Steps to connect remote host

Download the jprofiler from here : https://www.ej-technologies.com/download/jprofiler/files

1) run the jprofiler_linux_7_2_3.sh script in the local in order to install the jprofiler ui

2) copy the jprofiler7 directory  to the remote machine
-in remote machine start the agent and provide the port

[remote@localhost]  cd jprofiler7/bin/
[remote@localhost]$ ./jpenable
Connecting to org.apache.catalina.startup.Bootstrap start [20992] …
Please select the profiling mode:
GUI mode (attach with JProfiler GUI) [1, Enter]
Offline mode (use config file to set profiling settings) [2]
1
Please enter a profiling port
[31757]
8089
You can now use the JProfiler GUI to connect on port 8089

3) Attach the agent in your local [run the jprofiler]

session-integration wizard – new remote integration
and provide the information

Memory leak

To recognize a memory leak in the application go to “VM Telemetry Views” and if there are linear stripes, then it means that in the application some instances use a lot of memory.

If at the start you have a decent count of instances and on executing a command the number goes though the roof, then there is a “time bomb” problem. It will crack and it all depends on when. An optimization is in order, try to reduce the number of instances, size. Maybe some objects that are kept alive should be freed by the GC. To detect these objects you can go to “Heap Walker->Biggest Objects” and see for yourself the tree with the details. There you will have specified the packages and size.

Performance Analysis

The “Hot spots view” is a bottom-up view. JProfiler also offers a top-down view displaying the entire call tree. While the “Hot spots view” cumulative times for all invocation paths, the “Invocation tree” is perfect for finding single bottlenecks by expanding the tree along the large percentage values. It also gives you a feeling for the execution speed of various application components as well as a bird’s eye view of the call flow. This view is useful for debugging as well as profiling.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: