This page last changed on Apr 30, 2007 by mryall.

Introduction

There is a plugin for Confluence 2.2 and later which allows easy profiling using the YourKit profiler. No license is required to generate a memory or CPU snapshot, but you will need at least an evaluation license to analyse the results.

JIRA also has a plugin to profile JIRA's CPU and memory usage with YourKit.

Configuring YourKit in your JVM

Download YourKit 6.0 for your platform, and install it by following the installation instructions.

The following instructions apply to Confluence Standalone and Tomcat installations with Sun JDK 1.5. They should be easily applicable to other application servers and JVMs, however. The YourKit documentation covers this in more detail.

Windows configuration

On Windows, add to your PATH environment variable the bin/win32/ directory underneath the YourKit installation directory. For example, you might add "C:\Program Files\YourKit Java Profiler 6.0.12\bin\win32" to your PATH, via Control Panel, System, Advanced, Environment Variables.

To configure Confluence's JVM to use the YourKit agent, you need to add a parameter to JAVA_OPTS in the bin/setenv.bat file in your Confluence application directory. This file controls the startup parameters for Tomcat, so you'll need to restart it after making the changes.

Add the 'agentlib' parameter to the end like this:

set JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx256m -agentlib:yjpagent

Linux/Mac OS X configuration

On Unix-based systems, include the installation directory in the LD_LIBRARY_PATH environment variable, as shown below:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/yourKitAgent

In general, to configure a Sun 1.5 JDK, you add the agentlib parameter:

java -agentlib:yjpagent ...

You can add this to Tomcat's bin/setenv.sh like this:

JAVA_OPTS="-Xms128m -Xmx256m $JAVA_OPTS -Djava.awt.headless=true -agentlib:yjpagent "

Installing the YourKit plugin

Download the plugin and upload it into Confluence through the Administration, Plugins page.

A new menu option will appear under the 'Administration' heading. Click it and you should see the options to take a memory or CPU snapshot.


YourKit Profiling menu item

This profiler dump will be saved to a local temp directory, and the path shown once it is complete. For the CPU snapshot, this will take at least 30 seconds. For the memory snapshot, 10-15 seconds.


You can take either a memory or CPU snapshot

Why would I do this?

Analysing a profiler dump enables Atlassian Support (or you, if you are interested) to see exactly what is happening in your application: what classes are using the memory, what is using CPU and so on. This can help us debug tricky performance problems which would otherwise be impossible to analyse remotely.

Take a CPU snapshot if:

  • Confluence is sometimes unresponsive
  • Pages take a long time to load
  • Confluence's CPU usage is peaking.

Take a memory snapshot if:

  • Confluence's memory usage is higher than you expect
  • You are getting OutOfMemoryError's in your logs.

Plugin source code

The source code for this Confluence plugin is available from Subversion and browseable in Fisheye. To rebuild the JAR attached to this page, you need to run maven jar, and then extract the YourKit controller dependency (yjp-controller-api-redist-6.0.14.jar) and include that in the 'mashed' JAR too.


YourKitMenu.png (image/png)
yourkit-mashed-plugin-0.1.jar (application/octet-stream)
yourkit-plugin.png (image/png)
yourkit-plugin-0.2-yourkit-6.0.jar (application/octet-stream)
yourkit-plugin-0.2-yourkit-5.5.jar (application/octet-stream)
Document generated by Confluence on May 01, 2007 19:28