|
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.
On this page: Configuring YourKit in your JVMDownload YourKit 6.0 for your platform and follow the installation instructions to install it. 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 ConfigurationOn 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 ConfigurationOn Unix-based systems, include the installation directory in the library path environment variable, as shown below:
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 ImpactRunning 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 PluginDownload 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.
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.
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:
Take a memory snapshot if:
-agentlib:yjpagent=onexit=memory Plugin Source CodeThe 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/. |



Comments (10)
Jan 17, 2007
Rajendra says:
Instructions available in this sections are not clear. Here are the steps that ...Instructions available in this sections are not clear.
Here are the steps that I have followed to install Yourkit plugin for Confluence Wiki (2.2.4) on Linux using JDK 1.4 on Tomcat Application Server 5.0:
First find out the path where libyjpagent.so file is present for given OS.
Since we are using JDK 1.4, go to tomcat/bin
And modify "startup.sh" (in order to refer to yourkit library) as follows:
export CATALINA_OPTS="-Xms256m -Xmx1700m -DmyName=Confluence -Djava.awt.headless=true -Dbucket.indexing.threads.fixed=5 -Xrunyjpagent:onexit=memory,dir=/users/wiki"or refer to http://confluence.atlassian.com/display/JIRA/Setting+Up+YourKit+Agent+Parameter
Snapshots will be stored in directory set as "dir"
Hope this helps.
Few questions that I have still are:
1. Current Confluence Yourkit plugin has only one option i.e. to take the Memory snapshot. It doesn't explain how one can take the CPU Snapshots.
2. Also bit strange but worth to mention; whenever we ran the Yourkit plugin to take the memory snapshot, Apache has exceeded the max threads available due to which Wiki was inaccessible. Only way to restore the order was to restart tomcat, Apache.
hope this information helps for everybody!
regards,
Rajendra
Apr 30, 2007
Matt Ryall says:
Thanks for the info, Rajendra. I didn't cover instructions for JDK 1.4 because ...Thanks for the info, Rajendra.
I didn't cover instructions for JDK 1.4 because the profiling is markedly better in 1.5, and it also simplifies the document.
Anyone who is looking at improving performance should definitely investigate upgrading their JDK. In our testing, both JDK 1.5 and 1.6 deliver significant performance benefits over their predecessors.
Taking CPU snapshots is available in the new 0.2 release of the YourKit plugin. You can download it above.
May 01, 2007
Rajendra says:
Hi Matt, Yes, we have upgraded ourselves to JDK1.5. Addition of CPU snapshot fe...Hi Matt,
Yes, we have upgraded ourselves to JDK1.5. Addition of CPU snapshot feature is definitely going to be useful. Thanks for the same.
One question: When you say performance benefits, can you please explain how you do this benchmark testing ?
There is equivalent load testing we want to do it as we are planning to roll out Confluence Wiki to very large user audience and want to find out how much load one Confluence instance can handle. That will help us to know if need to go with Massive or not.
Can you please share some detailed tips on Atlassian does load testing, performance testing? I know there is one tool Megatron that is being shared. But I couldn't able to much follow with result output.
Your detailed answer is much appreciated.
thanks,
Rajendra
May 02, 2007
Matt Ryall says:
Our experience is anecdotal at the moment; the result of running JIRA's function...Our experience is anecdotal at the moment; the result of running JIRA's functional tests against Sun JDKs 1.4, 1.5, 1.6.
We're hoping to get some more detailed figures by adding performance analysis code to the test suite, but at the moment it's just the raw time to complete the entire suite of tests. There seemed to be a 20% improvement from 1.4 to 1.5, and a massive 50-60% from 1.5 to 1.6. The JIRA developers suspect the improvement mainly comes from storing local variables on the stack in 1.6, although again we have no evidence for this yet.
Nov 08, 2007
Eric Wells says:
Any chance you can make a version that works on an AIX server? Thanks, EricAny chance you can make a version that works on an AIX server?
Thanks,
Eric
Dec 12, 2007
Matt Ryall says:
Eric, if you can run the YourKit Java Profiler on AIX, then you should be able t...Eric, if you can run the YourKit Java Profiler on AIX, then you should be able to use this Confluence plugin. If you can't run the profiler on AIX, you'll need to contact YourKit and ask them to support it.
Feb 26, 2008
Keerthika Koteeswaran says:
I have Confluence 2.5.5 running on Tomcat server. There seems to be a missing in...I have Confluence 2.5.5 running on Tomcat server. There seems to be a missing instruction in the installation procedure documented here. I followed the steps above and I got this error message when I clicked on Yourkit Profiling in Administration:
I had to copy and save yjpagent.dll and yjp.ini in C:\Windows\system32 to finally get it running. I wonder if someone else has faced the same problem...
Feb 26, 2008
Matt Ryall says:
Keerthika, you missed this step in the instructions: On Windows, add to your PA...Keerthika, you missed this step in the instructions:
Copying these files to system32 is the equivalent of putting this YourKit directory on your PATH. However, this is not a recommended approach because you shouldn't modify files in that directory on a production system.
Mar 03, 2008
Karen Conneely says:
We are running Confluence 2.5.7/JDK 1.5.0/Tomcat 5.5. When selectin...We are running Confluence 2.5.7/JDK 1.5.0/Tomcat 5.5.
When selecting "YourKit Profiling", the following is displayed:
The issue is that I can't find "the bin/setenv.bat file in your Confluence application directory" or any reference to JAVA_OPTS. I have added the following to the Java Options within Tomcat properties but it didn't fix things:
"-agentpath:C:\Program Files\YourKit Java Profiler 7.0.11\bin\win32\yjpagent.dll"
Can you please tell me where I should be adding the "-agentlib:yjpagent" parameter?
Thanks,
Steve
Mar 03, 2008
Matt Ryall says:
Steve/Karen, when running Tomcat as a service you should add the -agentlib param...Steve/Karen, when running Tomcat as a service you should add the -agentlib parameter to Tomcat's VM parameters, just like you have done with the -agentpath one. The instructions above are for Confluence Standalone.
If you're still having problems, try adding the agent path to your PATH as described above, rather than using the -agentpath parameter. That is the method we have tested on Windows.
Add Comment