Documentation for JIRA 6.3 EAP developer (EAP) releases only. Not using this? See below:
(JIRA 6.2.x documentation | JIRA OnDemand documentation | earlier versions of JIRA)

Skip to end of metadata
Go to start of metadata

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 64 MB of memory, no matter how many gigabytes of memory your server may actually have available. 64 MB is inadequate for medium to large JIRA installations, and so this needs to be increased. Seeing OutOfMemoryErrors in the logs is symptomatic of this.

(warning) This page addresses how to increase Heap Space memory. Confirm that you're not receiving Perm Gen or GC Overhead errors.

On this page:

Step 1: Diagnosis

 Expand to see diagnosis section

Assess Root Cause

Icon

Often, there is a root cause for OutOfMemory Errors that may be better to address than just increasing memory. See JIRA Crashes Due to 'OutOfMemoryError Java heap space' for a discussion.

Determine JIRA usage patterns

To determine the JIRA usage patterns:

Choose > System. Select Troubleshooting and Support > System Info to open the System Info page. Then scroll down the page to view the Java VM Memory Statistics section and look at the memory graph during times of peak usage:

(info) This server has been allocated a maximum of 768 MB and a minimum of 256 MB (typically defined in the setenv script which is executed by running the start-jira script). If you are trying to see whether your settings are being picked up by JIRA, this is where to look. Here, you can see that JIRA has reserved 742 MB, or which 190 MB is actually in use. If this JIRA instance were running out of memory, it would have reserved the maximum available (768 MB), and would be using an amount close to this.

Determine available system memory

On Windows

From the Close Programs Dialogue (Press ctrl-alt-delete), select the Performance tab:

(info) The amount marked Available is the amount in kilobytes you have free to allocate to JIRA. On this server we should allocate at most 214 MB.

On Linux

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

As a rule of thumb, if you have fewer than 5000 issues, JIRA should run well with the default 768 MB. Granting JIRA too much memory can impact performance negatively, so it is best to start with 768 MB and make modest increases as necessary. As another data point, 40,000 works well with 768 MB to 1 GB.

Step 2: Increase Available Memory

Linux

 Expand to see Linux instructions
To increase heap space memory in Linux installations:
  1. In your <JIRA Installation Directory>/bin (or <Tomcat Installation Directory>/bin for JIRA WAR installations), open the setenv.sh file.
  2. Find the sections JVM_MINIMUM_MEMORY= and JVM_MAXIMUM_MEMORY=
  3. See Diagnosis above and enter the appropriate values.

Windows (starting from .bat file)

 Expand to see Windows .bat file instructions
To Configure System Properties in Windows Installations When Starting from the .bat File:
  1. In your <JIRA Installation Directory>/bin (or <Tomcat Installation Directory>/bin for JIRA WAR installations), open the setenv.bat file.
  2. Find the section set JVM_MINIMUM_MEMORY= and set JVM_MAXIMUM_MEMORY=
  3. See Diagnosis above and enter the appropriate values.

Windows Service

 Expand to see Windows Service instructions

There are two ways to configure system properties when starting Running JIRA as a Service, either via command line or in the Windows Registry.

Setting Properties for Windows Services via Command Line

Setting Properties for Windows Services via Command Line
  1. Identify the name of the service that JIRA is installed as in Windows ( Control Panel > Administrative Tools > Services ):

    (info) In the above example, the SERVICENAME is: JIRA120312230938
  2. Open the command window from Start > Run > type in 'cmd' > press 'Enter'
  3. cd to the bin subdirectory of your JIRA Installation Directory (or the bin subdirectory of your Tomcat installation directory if your are running the JIRA WAR distribution).
    For Example:

  4. For JIRA 5.1 or below:

    For JIRA 5.2 or above:

     

    (info) In the above example, it would be tomcat6w //ES//JIRA120312230938

  5. Click on the Java tab to see the list of current start-up options:
  6. 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.

To Set Properties for Windows Services via the Windows Registry,
  1. Go to Start > Run, and run "regedit32.exe".
  2. Find the Services entry:
    32-bit: HKEY_LOCAL_MACHINE > SOFTWARE > Apache Software Foundation > Procrun 2.0 > JIRA
    64-bit: HKEY_LOCAL_MACHINE > SOFTWARE > Wow6432Node > Apache Software Foundation > Procrun 2.0 > JIRA
  3. To change existing properties, especially increasing Xmx memory, double-click the appropriate value.
  4. To change additional properties, double-click options.
  5. Modify the memory allocations here.

Step 3: Verify Your Settings

 Expand to see verification instructions

To verify what settings are in place, check the <JIRA Home Directory>/logs/atlassian-jira.log or catalina.out file. A section in the startup appears like this:

(info) Look for Xmx (maximum) and Xms (minimum) settings.

This display is also available by Viewing your System Information.

30 Comments

  1. The -server option and the -Xms are also usefull on Tomcat .

    set JAVA_OPTS=-server -Xms512m -Xmx512m

    By default Tomcat is running in client mode.
    Xms is the initial allocated memory and Xmx the maximum memory.
    For better performance you should set both to the same value.

  2. to update the memory when running embedded tomcat as a service.

    Open command prompt, change to Jira\bin

    run "service remove jira" (or whatever name you used)

    edit the service.bat file and look for& edit the line
    "%EXECUTABLE%" //US//%SERVICE_NAME% ++JvmOptions "-Djava.io.tmpdir=%CATALINA_BASE%\temp" --JvmMs 512 --JvmMx 512

    in the line above I increased my memory to 512 initial and max.

    then run "service install jira"

    start the service and you should be in business.

  3. Abyone give some advice on how to do this in Websphere?  Webpsphere always allocates 256Mb to each application no matter how we start it.  At the moment we're getting a lot of out of memory errors.

    1. Darren, this can be done through the Web Console:
      Servers > Application Servers > server_name > Process Definition > Java Virtual Machine

      You can then define the Initial Heap size and the Max heap size.

      You will need to bounce the server.

      Cheers,
      Nick

  4. Hi.  The link under the Permanent Generation Space section doesn't seem to work.  Anyone know the specific article it is trying to point you to?  I see it's at www.theserverside.com but beyond that I haven't found it.

    Thanks,

    Brian

    1. Brian,

      It looks as the The Serverside have removed the article (or you need to log in to see it). Google has cached it though. This may also become stale in time....

      Cheers,
      Nick

    2. This explains the permanent generation space option nicely.

  5. JBoss' environment variables are configured in run.conf, not run.sh, at least for 4.2.1

  6. Hi all,

     Memory settings via tomcat commands seem do not work with Jira 3.11.

    The following error is returned 

    E:\Jira\JIRA-Enterprise-3.11\bin>tomcat5 //US//JIRA --JvmMs 256 --JvmMx 256
    [2007-11-05 09:58:52] [402  prunsrv.c] [error]
    The system cannot find the file specified.
    [2007-11-05 09:58:52] [1246 prunsrv.c] [error]
    Load configuration failed

    It works fine via Registry settings. 

     Any idea?

    Thanks,

    1. You can figure out the service name via regedit, via HKEY_LOCAL_MACHINE -> SOFTWARE -> Apache Software Foundation -> Procrun 2.0. At this branch it won't be listed as JIRA, but rather JIRA2934932 or something, and you can substitute this to your command line. (Would be useful for scripting). Eg.

      E:\Jira\JIRA-Enterprise-3.11\bin>tomcat5 //US//JIRA2934932 --JvmMs 256 --JvmMx 256

    2. JIRA service installed by the exe installer or thought command "service install" is named JIRA<set of digits>

      In the above example you should execute:

      tomcat5 //US//JIRA<set of digits> --JvmMs 256 --JvmMx 256

      You can find the JIRA service name by clicking it twice in MMC Service

  7. Is 1024 maximum setting for this?

    We got an error when we tried to increase memory settings over that, but I am not sure if that depends on how much physical memory the server has, on operating system (Windows 2003 Server) or it is JDK limitation.

    Timo Riikonen

    Accenture

  8. In the "Check available memory" section, the "Java VM Memory portion of the "System Info" display contains:

      Total Memory =-259MB,    Free Memory = 72 MB,   User Memory = 167 MB,

    and the memory graph shows 27% Free.

    In the paragraph that follows, which seems to be describing these statistics, there of values of 650Mb (maximum) and 256Mb (minimum), and 543 MB (reserved) and 310Mb (actually in use) mentioned.

    Am I correct in thinking that of these two sets of numbers, one (probably the second) is wrong?

    1. Anonymous

      Glad I'm not the only.

  9. How can i get the values for "Free Memory" and "% Free" from the server console running JIRA / Confluence (Linux, Tomcat) instead of logging in to the browser-based Administration interface?

    That would make it a whole lot easier writing a Nagios probe to monitor these values. Otherwise it would be kind of hard to script an automatic admin login, just to parse these values out of the HTML of the admin webinterface.

    Thanks for hints

    1. Anonymous

      We do this with SNMP. There are some helpful articles on the web that can lead you by the hand through the process, for example: http://www.ilikespam.com/blog/monitoring-the-jvm-with-snmp-mrtg

  10. Anonymous

    Hi All,

    there is one problem with current startup scripts running Jira with Linux + OpenJDK.

    I use CentOS 5.4. java -version says following:

    java version "1.6.0_0"
    OpenJDK Runtime Environment (IcedTea6 1.6) (rhel-1.11.b16.el5-i386)
    OpenJDK Client VM (build 14.0-b16, mixed mode)
    java version "1.6.0_0"

    OpenJDK Runtime Environment (IcedTea6 1.6) (rhel-1.11.b16.el5-i386)

    OpenJDK Client VM (build 14.0-b16, mixed mode)

    Under OpenJDK Perm size should be set with -XX:PermSize=<size> option instead of -XX:MaxPermSize= like IBM VM.

    So if I just run Jira with default scripts I face out of memory error with only 30 issues.

    I used following workaround for this problem: at file [JIRA_HOME]/bin/setenv.sh at line 43 add following text:

    JAVA_OPTS="-XX:PermSize=$

    Unknown macro: {JIRA_MAX_PERM_SIZE}

    $

    Unknown macro: {JAVA_OPTS}

    "

    If Jira development is going to support systems with OpenJDK I think this information should help them.

    Best regards,

    Kirill

  11. Anonymous

    The link to "[JIRAKB:Causes of OutOfMemoryErrors] page." is broken.

  12. Anonymous

    On 64-bit systems the registry path is:

    HKEY_LOCAL_MACHINE -> SOFTWARE -> Wow6432Node -> Apache Software Foundatino -> etc.

  13. I'm trying to change the jvm.dll to a 64bit JVM dll, but after doing this the service fails. Any idea how to make the service to run with a 64bit JVM?

  14. Edit: pardon me, I've focused on the Java Options field and completely missed the two fields below where I can do the task easily. Sorry.

    Section "Setting Properties for Windows Services via Command Line", step 6, actually doesn't say how to increase JIRA memory. I guess I should add something like -Xmx512m if I want to increase memory to 512 MB? Or do I need to set Xms too? Or is it -XX:MaxPermSize that I need to set?

  15. Anonymous

    Debian sun-java6-jre (= java version 1.6.0_26) keeps running out of memory causing the kernel to starts shooting down processes. Updating to the latest JRE directly from Oracle (=java version 1.6.0_31) solves this problem.

  16. Anonymous

    I've set JVM_MINIMUM_MEMORY and ..MAXIMUM in setenv.sh to 1024m. After this i rebootet ubuntu, but JIRA takes up to 2gb.... Why?

  17. Anonymous

    My Synology DS412+ has 1 GB of memory. I tried to reduce the JAVA_OPTS in setenv.sh:

    JAVA_OPTS="-server -Xms128m -Xmx128m -XX:MaxPermSize=128m $JAVA_OPTS -Djava.awt.

    e

    In additon in servers.xml I reduced the amount of simultaneous connections:

    maxProcessors="10"

    maxThreads="10" maxSpareThreads="2"

    However, does parameters do not make any difference. Confluence uses right away all the available memory (900 MB). I also tried the latest Java 6 version but again no difference.

     

    Anything else I can try?

    1. Anonymous

      Well. 

      Try to change.

      JAVA_OPTS="-server -Xms128m -Xmx128m -XX:MaxPermSize=128m $JAVA_OPTS -Djava.awt.

      with

      JAVA_OPTS="-client -Xms128m -Xmx128m -XX:MaxPermSize=128m $JAVA_OPTS -Djava.awt.

  18. Anonymous

    I've got the same error.

    However, when I try to run a different instance of JIRA, it works without problems.

    I tried to increase the memory according to all kinds of different instructions (including this one), however I don't have a setenv.* file where I could change the values.

    I'm acutally running a "test" version of JIRA on Ubuntu.

     

  19. Anonymous

    You should mention that, when using the atlassian-plugin-sdk you have to do something like this: https://answers.atlassian.com/questions/44640/java-heap-space-failure-while-restore-xml-backup-data

  20. Anonymous

    Was the JIRA installation on a DS412+ successful?  I have the same NAS and interested in installing it.  I upgraded memory to 2 GB.

  21. on Windows Server you can easily adjust memory settings .. no need for editing the BAT files and removing and installing the service again ..

    1. adjust these registry keys
      HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Apache Software Foundation\Procrun 2.0\JIRA6\Parameters\Java\JvmMs for minimum memory usage
      HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Apache Software Foundation\Procrun 2.0\JIRA6\Parameters\Java\JvmMx for maximum memory usage
      (JIRA6 is most likely not the name on of the service on your machine) 
    2. restart the JIRA Service
  22. JAVA_OPTS="-server -Xms16G -Xmx16G -Xmn8G -XX:MaxPermSize=256m -XX:+UseSerialGC -XX:-OmitStackTraceInFastThrow -XX:+UseCompressedOops -XX:+DoEscapeAnalysis -XX:+HeapDumpOnOutOfMemoryError -XX:MaxHeapFreeRatio=10 -XX:MinHeapFreeRatio=5 -XX:NewRatio=8 -XX:HeapDumpPath=/logs/tomcat_serv/ -XX:+PrintGCDetails -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -verbose:gc -Xloggc:/logs/tomcat_serv/gc.log -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dhttp.proxyHost=XXXXXX -Dhttp.proxyPort=8080 -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true -Dmail.mime.decodeparameters=true -Dfile.encoding=utf-8"