To profile your application from IntelliJ IDEA, choose one of the profiling commands in the Run menu, the context menu in the editor, or click on the corresponding toolbar button.
Main toolbar with 'Profile' button
'Run' menu with 'Profile' action
JProfiler is a commercially licensed Java profiling tool developed by ej-technologies GmbH, targeted at Java EE and Java SE applications. Features edit This section contains content that is written like an advertisement. JProfiler is a commercially licensed Java profiling tool developed by ej-technologies GmbH, targeted at Java EE and Java SE applications. Features edit This section contains content that is. . The IntelliJ IDEA integration is based on work by the leading IDEA plugin specialists at. Integrating JProfiler in any of these IDEs is exceptionally easy.
Editor context menu with 'Profile' action
- PerformanceStack.in is an effort to create a simple and common platform of Performance Testing & Engineering related tool stack and concepts. This platform focuses on providing an idea on the latest and mostly used tools in performance testing.
- Intellij-idea,jprofiler Is it possible to see the code in IntelliJ when the profiling is initiated from the standalone JProfiler application No, that is not possible, you have to start the profiling session from IDEA to get source code navigation in the IDE.
JProfiler can profile most run configuration types from IDEA, also applications servers. To configure further settings, please edit the run configuration, choose the 'Startup/Connection' tab, and select the 'Profile' entry. The screen shot below shows the startup settings for a local server configuration. Depending on the run configuration type, you can adjust JVM options or retrieve profiling parameters for remote profiling.
Startup settings for profiling of a local server configuration
The profiled application is then started just as with the usual 'Run' commands. If no instance of JProfiler is currently running, JProfiler is also started, otherwise the running instance of JProfiler will be used for presenting profiling data.
When JProfiler is started from IntelliJ IDEA, the 'Show source' action for a class or a method in one of JProfiler's view will show the source element in IDEA and not in JProfiler's integrated source code viewer. This works for Java as well as for Kotlin source code.
You can also open JProfiler snapshots from IDEA, either from the project window or the open file dialog in order to get source code navigation into IDEA.
With the Run->Attach JProfiler to JVM menu item, you can attach JProfiler to any locally running JVM or a JVM on a remote machine and get source code navigation in the IDE. Please see the help on attaching to JVMs for more information on attach mode.
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.
- JBoss Application Server (EAP/EPP) – Get the latest JBoss server from http://www.jboss.org/jbossas/downloads/
- JProfiler – Please download this profiling tool from http://www.ej-technologies.com/download/overview.html
- JDK 1.5 or greater.
The following servers/tools have been profiled using JProfiler while preparing writing this blog.
- JBoss EAP/EPP Server
- JProfiler 6.1.1
- 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? Check Trouble shooting section if your server is not started with JProfiler. In my case JProfiler started my server.
Jprofiler Idea
- 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.
Jprofiler Intellj Idea
- 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. 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
- 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.
Intellij Performance Profiling
Cheers,
Shashi