Enabling the YourKit Profiler with Apache Tomcat
search cancel

Enabling the YourKit Profiler with Apache Tomcat

book

Article ID: 293354

calendar_today

Updated On:

Products

VMware Tanzu tc Server

Issue/Introduction

Symptoms:

The YourKit profiler is a popular way to profile Java applications. In addition to plain Java applications, YourKit can be used to profile a Web application running in Apache Tomcat. This article provides steps to configure YourKit to profile a Web application deployed to Apache Tomcat.

Environment


Resolution

Note: This article assumes that YourKit is installed in the /opt/yjp-9.5.4 directory. The exact installation path and version number varies based on the installation of YourKit.

To integrate the YourKit profiler with an Apache Tomcat installation:
  1. Under the Tomcat installation, create and open the file bin/setenv.sh.
     
  2. Add a shell variable called YJP_HOME to the file and set the value to the installation directory for YourKit.

    For example: YJP_HOME="/opt/yjp-9.5.4"
     
  3. Add the shell variable called CATALINA_OPTS. Specify the argument -agentpath and point it to the location of the libyjpagent library file for your operating system and architecture. VMware also recommends to pass the following options into the YourKit profiler:
    disablestacktelemetry, disableexceptiontelemetry, builtinprobes=none, delay=10000
    Note: These options limit the performance impact of the profiler on Tomcat and the applications deployed to it.

    For example:
    For Linux 32bit Java  CATALINA_OPTS="-agentpath:$YJP_HOME/bin/linux-x86-32/libyjpagent.so=disablestacktelemetry,disableexceptiontelemetry,builtinprobes=none,delay=10000"
    For Linux 64bit Java  CATALINA_OPTS="-agentpath:$YJP_HOME/bin/linux-x86-64/libyjpagent.so=disablestacktelemetry,disableexceptiontelemetry,builtinprobes=none,delay=10000"
  4. Save and close the file.
  5. Restart the Tomcat installation. 
  6. Verify the first line of the logs/catalina.out file. It should be similar to: [YourKit Java Profiler 9.5.4] Loaded. Log file: /home/user/.yjp/log/7191.log. This indicates that the YourKit profiler is enabled for the Tomcat installation. If you do not see this line in the log file, check the changes made to the bin/setenv.sh file.
  7. Start the YourKit application. The Monitor Local Applications panel should now contain an entry for the Tomcat Server, labeled as Tomcat. 
  8. Click the link to start profiling an application deployed to the Tomcat installation.
For more information, see the Enabling profiling manually section of YourKit Java Profiler 9.5 Help.

Note: The preceding link was correct as of June 28, 2011. If you find the link is broken, provide feedback and a VMware employee will update the link.

©VMware 2013