Pages taking a long time to load due to full CodeCache

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

When a user tries to load the Editor or any page on Confluence, the load time is long.

Checking the browser logs, it's possible to see the request to the backend to get the batch.js and batch.css files taking most of the time.

Diagnosis

To find out what is causing the slowness to load the page, open the Developer Options on the browser.

The browser logs (HAR) can show all the requests made to load the page. In there it is possible to see which calls are taking most of the time.

The steps to generate the HAR file are described here: Generating HAR files and analyzing web requests.

With the HAR file, it's possible to see the calls taking a long time to load and what is being loaded:

(Auto-migrated image: description temporarily unavailable)

Cause

The batch.js and batch.css files are dynamically generated on the backend to deliver all necessary Javascript and CSS contents to the browser.

These files are different in every instance because they can vary in content and size depending on the plugins installed. Therefore, these files need to be generated on the go.

The JVM running the Confluence application has a limited amount of memory to cache the information of the files. Once that cache is full, it can slow down the operation.

Solution

  1. Make sure that browser caching is enabled all the time.

  2. Make sure that Gzip compression is enabled either on Confluence or better on the reserve proxy. This should save Confluence from losing CPU cycles on compression.

  3. Increase CodeCache by adding the below startup option to Confluence (setenv.sh/.bat):

1 -XX:ReservedCodeCacheSize=512m

More details on how to change system parameters here: Configuring System Properties.

See also

Health Check: JVM Code Cache

Confluence crashes due to CodeCache is full. Compiler has been disabled

Updated on February 28, 2025

Still need help?

The Atlassian Community is here for you.