Activity Stream Gadget in Confluence 3.1 Causes High CPU Usage
When the Confluence Activity Stream gadget is used on a page (Confluence or JIRA), the CPU(s) on the server run at high load for upwards of a minute each time the page is refreshed.
The Confluence Streams plugin shows how many changes have been made to the page. Showing the number of pages requires diffing them so that the changes can be counted. This causes two problems:
- The code is using a deprecated Confluence diff method that not only finds the changes, but also renders the HTML output to display the diff.
- For large pages, finding the diff is a huge performance hit.
The performance issue has now been rectified in Confluence 3.3, diffs are much faster, and for large pages (> 16KB), diffing is skipped altogether. This fix will be included in a future version of Confluence, progress on this can be tracked at Activity Stream Gadget in Confluence 3.1 Causes High CPU Usage.
In order to apply the fix without upgrading Confluence, upgrade to the most recent version of the activity streams plugin. Upgrading the plugin is not as straight forward as other plugins due to some issues with dynamic module types in plugins 2. The new version can't simply be installed via the web interface.
Here are the instructions for updating the streams plugin, with examples that should work using the Linux zip command:
- Backup the bundled plugins zip,
<Confluence install>/WEB-INF/classes/com/atlassian/confluence/setup/atlassian-bundled-plugins.zip,to a safe location in case you need to restore it.
- Remove the existing streams plugin,
streams-confluence-plugin-3.1.jar, out of the bundled plugins zip. Eg:
$ zip -d CONFLUENCE_WEBAPP/WEB-INF/classes/com/atlassian/confluence/setup/atlassian-bundled-plugins.zip streams-confluence-plugin-3.1.jar
- Download version 3.3 of the streams Confluence plugin from here. Eg:
$ wget https://maven.atlassian.com/contrib/com/atlassian/streams/streams-confluence-plugin/3.3/streams-confluence-plugin-3.3.jar
- Add this plugin to the bundled plugins zip. Eg:
$ zip CONFLUENCE_WEBAPP/WEB-INF/classes/com/atlassian/confluence/setup/atlassian-bundled-plugins.zip streams-confluence-plugin-3.3.jar
- Restart Confluence
If the problem persists, rollback the change by copying the previously backed up
atlassian-bundled-plugins.zip back to its original location.