Return to site

Jprofiler 10 1 1 – Java Based Applications Pdf

broken image


JProfiler is a powerful tool that you can use to profile Java based applications in a dynamic way and enables you to analyze them in hopes. Jprofilerwindows-x321115.exe main category. JProfiler How to profile standalone java applications. October 20, 2019 November 16, 2019 ymcoding. What are unit tests? Unit tests are a method of software testing.

This is my first technical blog and would like to discuss my experience in profiling JBoss Application Server (EAP/EPP) using JProfiler.

The following servers/tools are required.

  1. JBoss Application Server (EAP/EPP) – Get the latest JBoss server from http://www.jboss.org/jbossas/downloads/
  2. JProfiler – Please download this profiling tool from http://www.ej-technologies.com/download/overview.html
  3. JDK 1.5 or greater.

The following servers/tools have been profiled using JProfiler while preparing writing this blog.

  1. JBoss EAP/EPP Server
  2. JProfiler 6.1.1
  3. JDK 1.6

Step 1. Once JProfiler is download start the JProfiler using its exe or from start menu. You may see something as below

Step 2. Select the Server to profile. I am using JBoss EPP 4.3 so I am selecting JBoss 4.x server from list.

Step 3. In the next screen you have to specify where this JBoss server resides. If you are trying to profile remote server, you may have to have JProfiler agent running on remote server. In my case, I have my JBoss server in local machine

Step 4. In next wizard you have to specify JVM vendor you have been using in your machine. Please select appropriate JVM vendor, version and Mode. Also please check the box if you are using 64bit JVM! Here are my settings

Step 5. In the next wizard you have to specify whether your application server (JBoss) would like to wait for a connection from JProfiler GUI! I am specifying 'wait for a connection from the Profiler GUI' because it is easy to configure and flexible. Here is where I am now.

Step 6. In the next step, you have to specify the batch/script file used to start your application Server. Specify the run.bat location by browsing.

Step 7. In the next wizard, you have to specify the port to be for profiling connection. JProfiler by default uses 8849, check if you have this free (by using DOS command 'netstat –aon') otherwise you may have to change this port. In my case no other application using this port so I am going with the default.

Step 8. We are almost there. Check the required modifications we have done so far then click on Next.

Step 9. By this step, we have done enough configurations and our integration is finished. By this step your application is ready to be profiled and will be automatically started.

Step 10. In the next step, you may have to specify Initial profiling settings whether Instrumentation/Sampling. Instrumentation covers all features to be tune, so I am going with this. Check appropriate settings for your need

Step 11. Once you click Ok in Session Start-up window, you may notice that your JBoss server has already been started. You may see something like

Step 12. Check whether your JProfiler is started JBoss server as well? https://truegfiles543.weebly.com/radio-silence-2-3-download-free.html. Check Trouble shooting section if your server is not started with JProfiler. In my case JProfiler started my server.

  • By this time I assume your Server is running under profiling mode (In fact I would say listening to JProfiler for tuning). Click on 'Memory View' in left pane. You may something like below

This screen specifies the number of instances have been created for each class. You may also see the size of those instances occupying in memory.

  • If you want to check memory leakages for specific classes or at package level first try access your respective webpage through the URL in browser. This creates enough traffic on the server then you may have to change 'Aggregation level' and use 'Vie Filters' option. Please see below.
  • I don't have any application running on my server, but I captured below screen for tuning one of my project.

In the above screen I clearly see number of instances have been created and their size for my class/package.

  • Once you are finished accessing your webpage, try closing the browser and check whether created instances for respective class go down. Ideally since the application is not being accessed, garbage collector should remove the unused objects.
  • Generally it is up to JVM to run garbage collector, so we can run garbage collector through JProfiler (using Profiling -> Run Garbage Collector option). After running garbage collector (through JProfiler) if you see any variation then there is memory leakage (Problem to worry!)
  • Improved CPU hot spot view allows us to quickly see long hot spot values and the view filters now work for non-method hot spots, such as JDBC calls.

To do CPU profiling click on 'CPU View' left pane. Placeholder wizard 1 2. You may see something like

  • Again as we did while finding Memory Leakage, you may change 'Aggregation Level' and other fields to see thread specific data of your application.
  • One of the nice features I love is 'Call graph'. Click on 'Call graph' tab in 'CPU View' panel. You may have to select several options to create call graph as below (such as, appropriate thread selection and aggregation Level).
  • Once you fulfil all options you may something like below. (Again, I don't have any application running on my server, below screen captured from one of our projects).

Trouble Shooting

  1. If JProfiler doesn't start your JBoss Server – You may notice JProfiler creates new batch file at your JBoss server run.bat location with the name run_jprofile.bat. Check whether it is there or not. Run this run_jprofile.bat file and then start the same session in JProfiler. If you face any problem comment me, I may help you.

That's all about profiling experience I had. Please feel free to play around in JProfiler GUI. Happy Profiling!!!

Last but not least, I would really appreciate if you share your valuable comments and caught me if I was wrong anywhere.

Cheers,

Shashi

Java Performance Tuning
Java(TM) - see bottom of page
|home|services|training|newsletter|tuning tips|tool reports|articles|resources|about us|site map|contact us|
Tools: |GC log analysers|Multi-tenancy tools|Books|SizeOf|Thread analysers|Heap dump analysers|

Our valued sponsors who help make this site possible
JProfiler: Get rid of your performance problems and memory leaks!
Training online: Threading Essentials course

Tool Report: JProfiler

JProfiler
Get rid of your performance problems and memory leaks!

Modern Garbage Collection Tuning


Java Performance Training Courses
COURSES AVAILABLE NOW. We can provide training courses to handle all your Java performance needs

Java Performance Tuning, 2nd ed
The classic and most comprehensive book on tuning Java

Java Performance Tuning Newsletter
Your source of Java performance news. Subscribe now!


Training online
Threading Essentials course


JProfiler
Get rid of your performance problems and memory leaks!


Published June 2002

The JavaPerformanceTuning.com Tool Reports are designed to help readers makeinformed choices about the tools they may wish to use. JavaPerformanceTuning.com provides these reports as a service to our readers; JavaPerformanceTuning.com isnot responsible for the information provided by the tool author or vendor, nordo we necessarily endorse the products mentioned. JavaPerformanceTuning.com isnot responsible for any additional resources provided from the article (such asdownloadable files or other accessible material), even where we host such material.

TABLE OF CONTENTS

Getting Started

JProfiler is a Java profiler combining CPU, Memory and Thread profiling in one application. It is developed by ej-technologies and currently in version 1.2.

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.

For the example used in this article, we will profile a GUI application using a local session. We have selected the Jclasslib class file browser as our application (available from http://jclasslib.sourceforge.net), a tool for displaying Java class files and bytecode. While Jclasslib provides a lot of insight into the Java class file format, the bytecode display seems to be quite memory intensive and fairly sluggish for displaying large methods. We'll use JProfiler to identify the bottleneck.

If we were starting Jclasslib from the command line, we would use To start Jclasslib using JProfiler, we fill in the same details into the JProfiler sessiondetails window.

First, we create a new session to start the application, then we fill in the same details we would use on the command line: main class; class path; VM parameters. The VM parameters field here is used to change the look and feel of the class file browser.

JProfiler lets you specify which packages you want included in the profile report. This useful feature allows you focus on the bottlenecks separately from the various components of an application. The Jclasslib package starts with org., so we disable the corresponding filter on the 'active filters' tab of the configuration dialog (see second screenshot on the right). This ensures that org.* classes will be reported in our profile.

Now we have configured our session with all the necessary information, we save the session and start it. A terminal window appears, capturing the stdout and stderr output of the profiled application (Jclasslib in this example) and the Jclasslib class file browser appears. https://downmfile807.weebly.com/currencies-2-4-24.html. During the startup phase JProfiler immediately starts displaying live information in all its views. If you'd rather have static snapshots on demand, there are buttons for freezing all views and fetching data manually in the toolbar.


To identify the bottlenecks in Jclasslib, we now select a very large method to display in the Jclasslib browser window: for our example we will browse the javax.swing.MetalLookAndFeel.initComponentDefaults method, which is 9 kB of bytecode. Before we select the method for display, we reset the CPU data in JProfiler to eliminate the profiling information collected during startup of Jclasslib. We are interested in profiling the Jclasslib display action, not the Jclasslib startup. Displaying the javax.swing.MetalLookAndFeel.initComponentDefaults method in the Jclasslib browser takes quite a long a time, and the heap size expands to a whopping 40 MB. This is the inefficient action we want to look at for our example. We freeze all the views in JProfiler and start working on the analysis.


Performance Analysis

First, we look at the performance problem. The key to finding out where all the time is spent is JProfiler's 'Hot spots view'. The top level entries are the most time consuming methods. We can see immediately that most of the time is spent in javax.swing.AbstractDocument.insertString (53%) and java.awt.CardLayout.show (32%). By expanding the top level nodes we get the backtraces showing the various ways the hot spot method was called.

Here's where the 'filter sets' we earlier defined come into play. Of course, javax.swing.AbstractDocument.insertString calls a zillion other methods, but since javax. was selected as a filtered package, all these subsequent calls are summed up in the first method that was called from an unfiltered class, typically code written by yourself. What happens inside javax.swing.AbstractDocument.insertString is the internal mechanics of an external package which is outside your influence. If you were interested, you could always turn off the corresponding filter set.

From the CPU profile, we can see that all invocations to javax.swing.AbstractDocument.insertString originate in org.gjt.jclasslib.browser.detail.attributes.BytecodeDocument. This is the document that's used to display the method bytecode in the class file browser. The java.awt.CardLayout.show was then called when the document was actually displayed.


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' cumulates 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.

Both through the 'Hot spots view' and the 'Invocation tree' we arrive at the same conclusion: javax.swing.AbstractDocument.insertString is extremely slow (here over 1 ms per call) and preparing the document for rendering is equally costly. Next, we turn to memory profiling to see whether the large heap size is connected to this performance bottleneck.


Memory Usage Analysis

When we look at the garbage collector telemetry view, we can see that during the creation of the document a substantial number of short-lived objects are created on the heap. In the allocations monitor (second screen shot on the right), we can show the garbage collected objects by clicking on the trash can in the tool bar. By expanding the call tree along the large instance count values, we arrive at the same trouble spot as detected on the previous page. Below BytecodeDocument.setupDocument nearly 2 million objects have been allocated and garbage collected. This certainly constitutes a huge waste of resources completely out of proportion with respect to the performed task.

Jprofiler 10 1 1 – Java Based Applications Pdf


Now we'll use JProfiler's heap walker to examine this allocation problem from a close-up perspective. After taking a heap snapshot, we go to the classes view and find that more than half a million objects and 140000 arrays are still alive on the heap - mostly for displaying the 3000 lines in the bytecode document!

JProfiler's heap walker is quite different from the heap analysis views of competing products in that it operates on arbitrary object sets - and not on objects of a single class only. For every object set you can choose between six different views: classes, allocations, outgoing references, incoming references, class data and instance data. By selecting items in these views and using the navigation panel on the left, you can add new filter steps and modify your current object set. With the forward and back buttons in the tool bar you can move around in your selection history.

The classes view of the heap walker reveals three issues:

  1. there is an enormous amount of java.lang.ref.Finalizer objects on the heap, a package-private class that has to do with weak references
  2. there is an equally substantial count of int arrays and object arrays (the virtual machine has no type support for arrays of class instances, that's why it's denoted as []). The int arrays account for the largest chunk of memory.
  3. the heap is littered with small objects from the javax.swing.text package - this was to be expected after the previous findings.


Let's find out what these strange finalizer objects do. We add a filter step by selecting java.lang.ref.Finalizer, and choose the 'Outgoing references' in the navigation panel. The result is shown in the first screenshot on the right. Since java.lang.ref.Finalizer is derived from java.lang.ref.Reference it has a referent field which holds the content of the weak reference. Consequently, we select this referent field and choose the 'Classes' option in the navigation panel. As the second screenshot on the right shows, the overwhelming majority of weak references can be attributed to the javax.swing.text package.


Finally for object and int arrays we go back to the classes view and add filter steps by selecting the item in question and choosing 'Incoming references' from the navigation panel. As a result, the two screenshots on the right show who is referencing these arrays. Again, the javax.swing.text is responsible for allocating these resources.


Jprofiler 10 1 1 – Java Based Applications Pdf Download

Conclusion And Outlook

Obtaining a trial copy of JProfiler

Jprofiler 10 1 1 – Java Based Applications Pdf File

To get a 10-day evaluation copy of JProfiler, go to the trial download page, enter your name and e-mail address and download the version for your platform (Windows, Linux X86, Mac OS X or Solaris SPARC). With the Windows version, you get a setup executable that installs JProfiler and launches it right away. When running JProfiler for the first time, a setup wizard comes up and collects the license information that has been mailed to you as well as some information about your runtime environment. Moneydance 2017 10 – personal finance manager. When the 'open session' dialog appears, you're ready to go.

Last Updated: 2020-09-28
Copyright © 2000-2020 Fasterj.com. All Rights Reserved.
All trademarks and registered trademarks appearing on JavaPerformanceTuning.com are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries. JavaPerformanceTuning.com is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.
URL: http://www.JavaPerformanceTuning.com/tools/jprofiler/index.shtml
RSS Feed: http://www.JavaPerformanceTuning.com/newsletters.rss
Trouble with this page? Please contact us




broken image