Like any server application, Confluence may require some tuning as it is put under heavier use. We do our best to make sure Confluence performs well under a wide variety of circumstances, but there's no single configuration that is best for everyone's environment and usage patterns.

If you are having problems with the performance of Confluence and need our help resolving them, you should read this document: Requesting Performance Support

Antivirus Software

Antivirus software greatly decreases the performance of Confluence. Antivirus software that intercepts access to the hard disk is particularly detrimental, and may even cause errors with Confluence. You should configure your antivirus software to ignore the Confluence home directory, its index directory and any database-related directories.

Access logs

You can find out which pages are slow and which users are accessing them by enabling Confluence's built-in access logging.

Built-in Profiler

You can identify the cause of page delays using Confluence's built-in profiler according to Troubleshooting Slow Performance Using Page Request Profiling.

Enabling HTTP Compression

If bandwidth is responsible for bottlenecking in your Confluence installation, you should consider enabling HTTP compression. This may also be useful when running an external facing instance to reduce your bandwidth costs.
(warning) Take note of the known issues with HTTP compression in versions of Confluence prior to 2.8, which may result in high memory consumption.

Choice of Database

The embedded database that is provided with Confluence is meant only to be used for evaluation, or for low-volume Confluence sites. Once your site grows, you will almost certainly need to switch to an external relational database management system. Beyond this, we do not recommend any particular RDBMS over another. We recommend using what you are familiar with, because your ability to maintain the database will probably make far more difference to what you get out of it than the choice of database itself.

Database Indexes

If Confluence is running slowly, the most likely cause is that there is some kind of bottleneck in the database.

If you have the luxury of access to a DBA, it would be worthwhile having them tune the database specifically to the demands that your particular Confluence installation is placing on it. If you do not have a DBA, you may want to consult the database indexing advice that we have been gathering from customer reports and our own experience running and developing Confluence. The instructions on that page are for Oracle, but most of the indexes can be applied to (and will help with) any database.

(These database indexes are now created automatically when Confluence is installed, but existing installations upgrading to a more recent version may still need to add them manually)

Cache Tuning

To reduce the load on the database, and speed up many operations, Confluence keeps its own cache of data. Tuning the size of this cache may speed up Confluence (if the caches are too small), or reduce memory (if the caches are too big). Future versions of Confluence will allow you to tune the size of this cache from within the web application.

In Confluence 2.3 to 2.5, the cache is configured in confluence/WEB-INF/classes/confluence-coherence-cache-config.xml (or confluence/WEB-INF/classes/confluence-coherence-cache-config-clustered.xml for clustered versions). In Confluence 2.6, these files can be found in confluence/WEB-INF/lib/confluence-2.6.0.jar.

There is also a Cache Statistics page provided with Confluence. This page shows the size of each cache and its hit ratio.

Important Caches

  • com.atlassian.confluence.core.ContentEntityObject should be set to at least 20-30% of the number of content entity objects (pages, comments, emails, news items) in your system. To find the number of content entity objects, use the query select count(star) from CONTENT.
  • com.atlassian.confluence.core.ContentEntityObject.bodyContents should be set to at least 20% of the number of content entity objects (pages, comments, emails, news items) in your system. To find the number of content entity objects, use the query select count(star) from CONTENT.
  • com.atlassian.confluence.security.PermissionCheckDispatcher.isPermitted() should be set to at least the number of concurrent users you expect to access Confluence at the same time
  • com.atlassian.confluence.user.DefaultUserAccessor.deactivatedUsers must be set to at least the number of users with USE_CONFLUENCE permission (don't worry, it only takes up a few bytes per user). To find an upper bound for this, use the query select count(star) from OS_USER, or if you have configured atlassian-user.xml to use the Hibernate repository, select count(star) from users.
  • com.atlassian.confluence.security.SpacePermission should be set to the number of space permissions in your deployment (a good rule of thumb is 20 times the number of spaces). You can find the number of space permissions using the query select count(star) from SPACEPERMISSIONS.

The following are more specific performance problems that can be resolved from tuning the cache.

LDAP cache sizes and expiry does not appear to be picked up.

This is a known problem, please refer to CONF-11858 for the solution.

"Edit Page" screen takes a long time to load

If your installation of Confluence is suffering from this problem, it may be due to a insufficient SpacePermissions cache size. To address this problem, first determine the number of space permission objects in your Confluence instance. You can do this by running this query against your database:

> select count(*) from SPACEPERMISSIONS

Now locate the cache entry for SpacePermissions in your ehcache.xml file. It looks like this:

<cache name="com.atlassian.confluence.security.SpacePermission" 
       maxElementsInMemory="10000" eternal="false" 
       timeToIdleSeconds="3600" timeToLiveSeconds="0" 
       overflowToDisk="false" />

The equivalent for confluence-coherence-cache-config.xml would be:

<local-scheme>
        <scheme-name>cache:com.atlassian.confluence.security.CachingSpacePermissionManager.permissions</scheme-name>
        <scheme-ref>default</scheme-ref>
        <high-units>10000</high-units>
        <expiry-delay>0s</expiry-delay>
</local-scheme>

Adjust the maxElementsInMemory or high-units property to the number of space permissions you have (in the example above, I've used 10000). Also, just as important, you need to adjust the timeToLiveSeconds or expiry-delay property to 0.

Note: 10K of space permissions consumes approximately 8MB of memory. Please ensure there is enough memory allocated to your instance to cater for this.

How to set specific cache settings

  1. Find the cache name from the cache name mappings:
    • For Confluence 2.5.x and earlier, the cache name mappings are in file confluence/WEB-INF/classes/com/atlassian/confluence/admin/actions/cache-name-mappings.properties.

    • For Confluence 2.6.0 and later, you will find the cache name mappings in the file
      com/atlassian/confluence/core/ConfluenceActionSupport.properties
      which is packed into the confluence-2.x.*.jar file.
  2. Find the appropriate <cache-mapping> tag in confluence-coherence-cache-config.xml or confluence-coherence-cache-config-clustered.xml. If the tag doesn't exist, you can create it within the <caching-scheme-mapping> tag.

    Attached to this page are corrected copies of confluence-coherence-cache-config.xml and confluence-coherence-cache-config-clustered.xml. These are updated from a bug CONF-11857.

  3. The <scheme-name> will correspond to a <local-scheme> tag below. It refers to a scheme reference. Either change the high-units tag in the scheme reference, or add a high-units tag to override the scheme reference. For example, the following tag would change the Content Bodies cache from the default 1000 units to 2000 units:
    <local-scheme>
    <scheme-name>cache:com.atlassian.confluence.core.ContentEntityObject.bodyContents</scheme-name>
    <high-units>2000</high-units>
    <scheme-ref>default</scheme-ref>
    <expiry-delay>0s</expiry-delay>
    </local-scheme>
    

    Another popular cache to change is the LDAP related User cache:
    <local-scheme>
    <scheme-name>user</scheme-name>
    <scheme-ref>default</scheme-ref>
    <high-units>5000</high-units>
    <expiry-delay>300s</expiry-delay>
    </local-scheme>
    
  4. After updating the appropriate file, you do not need to repack it into the jar to use it. You can simply place the file in your confluence/WEB-INF/classes/ directory. The file in this directory will override the settings in your jar file. If you want to back out the changes, you only need to remove the file from your confluence/WEB-INF/classes/ directory — then the default values in the confluence-coherence-cache-config.xml located in your jar file will apply.

You can find more information about configuring the Coherence cache in the Coherence cache documentation.

Default Cache Size and Expiry

If a cache has not been defined, then it will use the default cache size and expiry. As the start of your confluence/WEB-INF/classes/confluence-coherence-cache-config.xml file you will notice the following:

<cache-mapping>
	<cache-name>*</cache-name>
	<scheme-name>default</scheme-name>
</cache-mapping>

So basically all caches will default to using the default scheme, which is defined as below:

<local-scheme>
	<scheme-name>default</scheme-name>
	<class-name>com.atlassian.confluence.cache.tangosol.ExpiryCountingLocalCache</class-name>
	<high-units>1000</high-units>
	<expiry-delay>3600</expiry-delay>
</local-scheme>

I.e. with a size of 1000 and an expiry of 3600 seconds. Other schemas use the above as their default and either override the size of the cache, or the length of the expiry.

Adjust Application Server Memory Settings

See Managing Application Server Memory Settings.

Use A Web Server

For high-load environments, performance can be improved by using a web server such as Apache in front of the application server. There is a configuration guide to Running Confluence behind Apache.

When configuring your new web server, make sure you configure sufficient threads/processes to handle the load. This applies to both the web server and the application server connector, which are typically configured separately. If possible, you should enable connection pooling in your web server connections to the application server.

Parallel GC

If you have a large of CPU's on your server you can add -XX:+UseParallelGC to your JAVA_OPTS options. This will allow garbage collection to happen in parallel with the application and can boost performance. For more information please refer to http://java.sun.com/docs/hotspot/gc5.0/gc_tuning_5.html#1.1.%20Types%20of%20Collectors%7Coutline.

RELATED TOPICS

Performance Testing Scripts
Working with Confluence Logs
Operating Large or Mission-Critical Confluence Installations
Confluence Clustering Overview
Requesting Performance Support
Administrators Guide
Configuration Guide