This page last changed on Mar 08, 2011 by bmallow.
Java applications like JIRA and Confluence run in a "Java virtual machine" (JVM), instead of directly within an operating system. When started, the Java virtual machine is allocated a certain amount of memory, which it makes available to applications like JIRA. By default, Java virtual machines are allocated 64Mb of memory, no matter how many gigabytes of memory your server may actually have available. 64Mb is inadequate for medium to large JIRA installations, and so this needs to be increased.
On this page:
Step 1: Diagnosis
Expand to see diagnosis section
Determine type of error message
Look in the atlassian-confluence.log to see which type of OutOfMemory Error you're receiving. There are three common messages:
- Heap Space
- Perm Gen Space
- GC Overhead
Determine Confluence's usage patterns
In JIRA, go to Administration » System » System Info, and look at the memory graph during times of peak usage:

This server has been allocated a maximum of 650Mb and a minimum of 256m. You can see the minimum displayed here; if you're trying to see whether your settings are being picked up, this is where to look.
Determine available system memory
From the Close Programs Dialogue (Press ctrl-alt-delete), select the Performance tab:

The amount marked Available is the amount in kilobytes you have free to allocate to Confluence. On this server we should allocate at most 214Mb.
Run cat /proc/meminfo to view the memory usage.
Setting the -Xmx above the available amount on the server runs the risk of OutOfMemoryErrors due to lack of physical memory. If that occurs the system will use swap space, which greatly decreases performance.
Guidance
The default values supplied with Confluence stand-alone are sufficient for most installations. Please refer to Managing Application Server Memory Settings and Server Hardware Requirements Guide for a discussion.
Step 2: Increase Available Memory
Linux
Expand to see Linux instructions
- From <confluence-install>/bin (Stand-alone) or <Tomcat-home>/bin (EAR-WAR installation), open setenv.sh (you can create this file in the EAR/WAR version).
- Find the section JAVA_OPTS="-Xms256m -Xmx512m -XX:MaxPermSize=256m ...
- See Diagnosis above and enter the appropriate values. Xmx is maximum, Xms is minimum, and MaxPermSize is PermGen.
Windows (starting from .bat file)
Expand to see Windows .bat file instructions
- From <confluence-install>/bin (Stand-alone) or <Tomcat-home>/bin (EAR-WAR installation), open setenv.bat.
- Find the section set JAVA_OPTS=%JAVA_OPTS% -Xms256m -Xmx512m -XX:MaxPermSize=256m
- See Diagnosis above and enter the appropriate values. Xmx is maximum, Xms is minimum, and MaxPermSize is PermGen.
Windows Service
Expand to see Windows Service instructions
There are two ways to configure system properties if you Start Confluence Automatically on Windows as a Service - either via command line or in the Windows Registry
Setting Properties for Windows Services via Command Line
- Identify the name of the service that Confluence is installed as in Windows ( Control Panel > Administrative Tools > Services ):

In the above example, the SERVICENAME is: JIRA030908110721
- Open the command window from Start >> Run >> type in 'cmd' >> Enter
- cd to the bin directory of your Confluence Standalone instance, or the bin directory of your Tomcat installation if your are running Confluence EAR/WAR.
- Run:
tomcat6w //ES//%SERVICENAME%
.
In the above example, it would be tomcat6w //ES//JIRA030908110721 (this is a JIRA screenshot, but the same applies to Confluence)

- Click on the Java tab to see the list of current start-up options:

- Set the maximum memory allocation here
Setting Properties for Windows Services via the Windows Registry
In some versions of Windows, there is no option to add Java variables to the service. In these cases, you must add the properties by viewing the option list in the registry.
- Go to {{Start >> Run, and run "regedit32.exe".

- Find the Services entry:
32-bit: HKEY_LOCAL_MACHINE >> SOFTWARE >> Apache Software Foundation >> Procrun 2.0 >> Confluence
64-bit: HKEY_LOCAL_MACHINE >> SOFTWARE >> Wow6432Node >> Apache Software Foundation >> Procrun 2.0 >> Confluence

- To change existing properties, especially increasing Xmx memory, double-click the appropriate value.

- To change additional properties, double-click options. Note: Make sure to add only one argument per line.
- Modify the memory allocations here.
Step 3: Verify Your Settings
Expand to see verification instructions
To verify what settings are in place, check Viewing System Information. You should see a section called "Java Runtime Arguments".
Look for Xmx (maximum) and Xms (minimum) settings.
Alternatively, on Linux, run ps -aux | grep java to see the environment parameters.
|