Cache Performance Tuning

Confluence performance can be significantly affected by the performance of its caches. 

Before you change the size of your caches, it's important to take a baseline so you can measure how effective each individual change is, and decide whether they are needed.

On this page we'll take you through some example statistics and discuss how you might be able to improve Confluence performance by resizing these caches. 

If you just want to check your cache statistics, or make a change to your cache config, see Cache Statistics.

On this page:

Cache tuning example


As an example of how to tune Confluence's caches, let's have a look at the following table:

Caches

% Utilization

% Effectiveness

Objects/Size

Hit/Miss/Expiry

Attachments

87%

29%

874/1000

78226/189715/187530

Content Attachments

29%

9%

292/1000

4289/41012/20569

Content Bodies

98%

81%

987/1000

28717/6671/5522

Content Label Mappings

29%

20%

294/1000

4693/18185/9150

Database Queries

96%

54%

968/1000

105949/86889/83334

Object Properties

27%

18%

279/1000

5746/25386/8102

Page Comments

26%

11%

261/1000

2304/17178/8606

Users

98%

5%

982/1000

6561/115330/114279

The maximum size of the caches above is 1000 (meaning that it can contain up to 1000 objects). You can tell when a cache size needs to be increased because the cache has both:

  • a high usage percentage (above 75%)
  • a low effectiveness percentage.

Check the 'effectiveness' versus the 'percent used'. A cache with a low percent used need not have its size lowered; it does not use more memory until the cache is filled.

Based on this, the sizes of the "Attachments", "Database Queries", and "Users" caches should be increased to improve their effectiveness.

As the stored information gets older or unused it will expire and be evicted from the cache. Cache expiry can be based on time or on frequency of use.

There's not much that you can do with a cache that has both a low percentage of usage and effectiveness. Over time, as the cache is populated with more objects and repeat requests for them are made, the cache's effectiveness will increase.

Important caches

The following suggestions are general guidelines. In cases of large databases, 20-30% of the size of the table may be unnecessarily large. Check the effectiveness and percent used categories in the cache for more specific assessments.


  • Content Objects cache (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(*) from CONTENT where prevver is null.
  • Content Body Mappings cache (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(*) from CONTENT where prevver is null.
  • Embedded Crowd Internal User cache (com.atlassian.crowd.model.user.InternalUser)
    should be set to the number of users you have in the internal directory.  You can discover this number by using the following SQL: 

    SELECT
        COUNT(*)
    FROM
        cwd_user u
    JOIN
        cwd_directory d
    ON
        u.directory_id = d.id
    AND d.directory_name = 'Confluence Internal Directory';
  • Embedded Crowd Users cachecom.atlassian.confluence.user.crowd.CachedCrowdUserDao.USER_CACHE 
    should be set to the number of rows in the cwd_user table. 

    SELECT
     COUNT(*)
    FROM
     cwd_user u;
  • Space permissions by ID cache (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(*) from SPACEPERMISSIONS.


Last modified on Mar 31, 2023

Was this helpful?

Yes
No
Provide feedback about this article

In this section

Powered by Confluence and Scroll Viewport.