1. How to profile AeroWebb endpoint¶
Prerequisites
- Have a working AeroWebb installation see developer guide.
- Enable JFR for tomcat
- Install JMC
- Optional : install VisualVM.
- Optional : increase the stack depth limit for JFR stack traces (see JFR config page for more info)
1.1 Profiling¶
Definition from wikipedia.org :
In software engineering, profiling ("program profiling", "software profiling") is a form of dynamic program analysis that measures, for example, the space (memory) or time complexity of a program, the usage of particular instructions, or the frequency and duration of function calls. Most commonly, profiling information serves to aid program optimization, and more specifically, performance engineering.
Profiling is achieved by instrumenting either the program source code or its binary executable form using a tool called a profiler (or code profiler). Profilers may use a number of different techniques, such as event-based, statistical, instrumented, and simulation methods.
In this section we will see how toprofile and analyze an AeroWebb endpoint.
1.1.1 Start Tomcat¶
Start tomcat with the aerowebb.war version you want to profile. Ensure JFR has been enabled before startup.
1.1.2 Target the endpoint(s) you want to profile¶
To avoid recording superfluous data and precisely target the methods you want to analyze, preemptively take any steps such as login into AeroWebb (and getting to the screen/pop-up/button/etc you want to analyze if using the AeroWebb GUI).
1.1.3 Start a recording¶
- Start JMC and find your tomcat process in the JVM Browser
- Right click on the Flight Recorder button and select Start Flight Recording

A wizard opens to help you configure the recording :

In descending order :
- In red : customize the output folder where the .jfr file will be saved
- In blue : customize the name of the recording
- In green : customize the length of the recording. If you don't know how long the endpoint(s) you want to profile will take, you can choose continuous. Either way you can stop the recording at any time.
- In black : customize the template you want to use for the recording settings. Dictates how and which events are recorded.
By default, JMC comes with 2 base templates : Profiling (on server) and Continuous (on server).
Continuous has less overhead and is designed to be safe to use in production environments while Profiling is more for in-depth analysis (recommended setting).
If you need to fine-tune more settings, you can check what is available in Next. Default configuration should be enough in most cases.
Click on finish to start the recording.
1.1.4 Collect data¶
Once the recording has started, call the endpoint(s) you want to analyze (from AeroWebb GUI, Postman etc.). During the duration of the recording, all events will be recorded. Once the recording has ended, a .jfr file containing all information will be generated and written to disk.
If you specified a duration, you can let the recording run out. But again, in order to minimize noise in the collected data, it is suggested to manually stop the recording once your endpoint(s) are done processing. To do so, right click on the recording and select Stop.

Once the recording has ended, the .jfr file is generated and saved to disk and a view is opened in JMC with the results.
1.1.5 Timing of methods¶
JMC offers a rich summary of what is inside the .jfr file, but it might not be enough : for instance, I have yet to figure out how to display time spent in each methods.
Fortunately, VisualVM has this feature and can open .jfr files. Head to Sampler → CPU to display this information. In some cases, it might be tricky to find the thread on which your methods executed but ordering by Total Time (CPU) usually helps. Also, some time values might be deceiving and not reflect what really happens, so caution is advised.

Created: 2024-01-30