Confluence Docs 3.0 : Profiling using the YourKit Plugin This page last changed on Mar 17, 2008 by smaddox. 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.
On this page: Configuring YourKit in your JVM Windows Configuration Linux/Mac OS X Configuration Performance Impact Installing the YourKit Plugin Why would I do this? Plugin Source Code ### Configuring YourKit in your JVM Download YourKit 6.0 for your platform and follow the installation instructions to install it. Note: YourKit version 7 is not compatible with the Confluence yourkit plugin. 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 library path environment variable, as shown below: For the Mac: `export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/path/to/yourKitAgent` For other Unix-based systems: `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 "
### Performance Impact Running YourKit can have detrimental effects on performance. To minimize performance problems use the following modifications to the agentlib parameter:
    -agentlib:yjpagent=disablecounts,disablealloc,disablej2ee
See also Profiling overhead: how to reduce or avoid in the YourKit documentation. ### 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. If you run into situations where Confluence is unresponsive and you are not able to trigger a memory snapshot, please ensure that you start Confluence with the `onexit=memory` parameter in the JVM options (as in the example below) and simply shut down Confluence. Before shutting down a memory snapshot will be created.
     -agentlib:yjpagent=onexit=memory
### Plugin Source Code The source code for this Confluence plugin is available from Subversion and browseable in Fisheye. The JAR produced by 'mvn package' includes a copy of the YJP redistributable bundled in META-INF/lib/. Attachments: 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) confluence-yourkit-plugin-0.3.jar (application/octet-stream) confluence-yourkit-plugin-0.4.jar (application/octet-stream)

Document generated by Confluence on Nov 05, 2009 23:36