Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to profile a Java web application servlet call in Eclipse EE Luna

In my web application a servlet needs multiple seconds even before it starts to write the response. I would like to find out, which methods are called during servlet execution and what time each method takes.

Is there a profiler already included in the Luna release of Eclipse IDE for Java EE Developers? How do I activate it?

There is a lot information available on the web, but it seams names change all the time so I have difficulties to filter the relevant.

like image 863
Witek Avatar asked Sep 08 '14 19:09

Witek


People also ask

How do I create a profile in Eclipse?

To create a new profile, you can go to Window → Preferences and go to Java → Code Style → Formatter. Click the New button. I created a profile called "myprofile", based on the built-in Eclipse profile. I brought up the profile editor.

How to open Eclipse IDE for Java?

To run Eclipse, open the " /usr/local/eclipse " folder and click on the "Eclipse" icon; or start a "Terminal", enter "eclipse".

Why we use Eclipse for Java?

Developed using Java, the Eclipse platform can be used to develop rich client applications, integrated development environments and other tools. Eclipse can be used as an IDE for any programming language for which a plug-in is available.


1 Answers

JVM Monitor 3.8 works fine with Eclipse Luna and it is also quite simple to use.

  1. download and install from eclipse marketplace
  2. restart eclipse
  3. start your application
  4. open JVM Explorer view via window > show view [> other ]> Java Monitor > JVM Explorer
  5. find your app server process, right click on it and pick Start Monitoring
  6. you should now land in the Properties view and see graphs with cpu and memory usage
  7. select the CPU tab
  8. click on select profiled CPU packages (you can always change them with right click > properties)
  9. in the top right corner of the Properties tab click on Start CPU Profiling (or it may be called Resume CPU Profiling)

Now your call tree should be populated as you interact with your application and you can analyse the method calls and their duration. The output should look like this:

Profiler example output

like image 160
JanM Avatar answered Sep 20 '22 15:09

JanM