Increasing JIRA Memory

All Versions

JIRA 4.0 Beta Documentation

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 apps 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. Seeing OutOfMemoryErrors in the logs is symptomatic of this.

On this page:


If you are seeing OutOfMemoryErrors, it is a good idea to also review the Causes of OutOfMemoryErrors page.

Checking available memory

How much memory is JIRA currently using? This can be determined by a JIRA administrator. In JIRA, go to Administration » System » System Info, and look at the memory graph:

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. Of this, JIRA has reserved 543Mb, or which 310Mb is actually in use (this JIRA instance has about 6000 issues).

If this JIRA instance were running out of memory, it would have reserved the maximum available (650Mb), and would be using an amount close to this.

Increasing available memory

How much memory do you need? As a rule of thumb, if you have less than 5000 issues, JIRA should run fine in 256Mb. Granting JIRA too much memory will hurt performance, so it's best to start with 256Mb and make modest increases as necessary. As another data point, 40,000 issues fits comfortably into 750Mb.

How much memory do you have?

On Windows, press ctrl-alt-delete, and click on the Performance tab:

The amount marked Available is the amount in kilobytes you have free to allocate to JIRA (On linux, cat /proc/meminfo shows the memory usage). On this server we should allocate at most 214Mb. Any more, and we risk OutOfMemoryErrors due to lack of physical memory, and are certain to go into swap, which greatly decreases performance.

Tomcat Windows Service

If you are running Tomcat (eg. that bundled with JIRA Standalone) on a Windows server, then JIRA should be installed as a service. To set the maximum memory limit of the service, click Start, then *Run..." and type regedt32:

In the registry editor, click to HKEY_LOCAL_MACHINE -> SOFTWARE -> Apache Software Foundation -> Procrun 2.0 -> JIRA -> Parameters -> Java. Here you will see an entry for JvmMx, which is the "maximum memory" setting.

Double-click JvmMx to edit, change the Base to "Decimal" and adjust the value as necessary:

Additionally, if running Confluence (or other webapps) in the same Tomcat instance as JIRA, you should click Options, and add -XX:MaxPermSize=128m:

Click "OK", close the registry editor and restart the JIRA Windows service (under Start -> Settings -> Control Panel -> Administrative Tools -> Services).

Memory and options can also be adjusted using tomcat5.exe with commands like:

tomcat5 //US//JIRA --JvmMs 256 --JvmMx 256

and:

tomcat5 //US//JIRA ++JvmOptions="-XX:MaxPermSize=128m"

This is how the Tomcat Service docs suggest it be done; however you would need to figure out the JIRA service name first (it will be JIRA180707161544 or something, not just JIRA. In Windows, you can find the JIRA service name under Start -> Settings -> Control Panel -> Administrative Tools -> Services. The name will usually begin with 'Atlassian JIRA'). The regedt32 method described above is better, as it is less prone to failing with cryptic errors.

Note that the commands shown above apply only if you have installed the service manually. If you installed the service via the Windows installer, replace 'JIRA' with 'JIRA<timestamp value>'.

Tomcat on Windows (started manually)

If you run Tomcat (eg. from JIRA Standalone) on Windows, and are starting it manually by running bin\startup.bat, edit bin\setenv.bat and add the line:

setenv.bat
set JAVA_OPTS=-Xms256m -Xmx256m

and then restart. Adjust 256 to the maximum memory you want to allocate.

If bin\setenv.bat does not exist, create it.

Tomcat on Unix

Edit the bin/setenv.sh file and add:

setenv.sh
export JAVA_OPTS="-Xms256m -Xmx256m"

and then restart.

If bin/setenv.sh does not exist, create it.

Other application servers

Java applications all start by running a command

java <args>

where <args> varies. To increase the memory, add a -Xmx parameter. Eg. to use 256Mb, run

java -Xmx256m <args>

JIRA is run in an application server (Tomcat, Orion, Websphere, Weblogic, JBoss etc), and these app servers usually have scripts wrapping the actual java call. The -Xmx parameter is usually passed into these scripts through an environment variable. For app servers installed as a Windows Service, there is typically a command to run to set the -Xmx parameter for the service (eg. the tomcat service installer). Here is a list of app servers, and how to set the parameter for each:

AppServer Startup script Variable to edit Example
Orion n/a n/a java -Xmx512m -jar orion.jar -userThreads
Weblogic $BEA_HOME/domain/<domain>/startWebLogic.sh JAVA_OPTIONS export JAVA_OPTIONS="$JAVA_OPTIONS -Xmx256m"
JBoss bin/run.sh JAVA_OPTS export JAVA_OPTS=-Xmx256m
Resin 3.0.x bin/httpd.sh n/a
Start with httpd.sh -J-Xmx256m

Note that the above instructions configure JIRA to use 256 MB of memory only when it needs to. JIRA will start using less memory and will grow to maximum of 256MB if required. So after launching JIRA the System Info page will likely report that JIRA is using much less than 256MB of memory.

Permanent Generation Memory

In some cases, such as when running JIRA and Confluence together, the server can run out of a different type of memory (Permanent Generation), and if this is the case the above settings may not help solve the memory issue. A problem like this may occur when running multiple applications on the same server.

If you are experiencing this type of error, you would most likely see the following error in your logs:

java.lang.OutOfMemoryError: PermGen space

To increase the level of this memory another java parameter will need to be added:

-XX:MaxPermSize=128m

As mentioned above, for Windows services this is done by editing the service "Options" parameter in the registry:

Labels

jvm jvm Delete
performance performance Delete
tomcat tomcat Delete
memory memory Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Sep 15, 2005

    Sven Breidenstein says:

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

    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. Oct 05, 2005

    Simon Taylor says:

    to update the memory when running embedded tomcat as a service. Open command pr...

    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. Apr 06, 2006

    Darren Bell says:

    Abyone give some advice on how to do this in Websphere?  Webpsphere always ...

    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. Apr 10, 2006

      Nick Menere says:

      Darren, this can be done through the Web Console: Servers > Application Serve...

      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. Jul 18, 2006

    Brian Sutton says:

    Hi.  The link under the Permanent Generation Space section doesn't seem to ...

    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. Jul 18, 2006

      Nick Menere says:

      Brian, It looks as the The Serverside have removed the article (or you need to ...

      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. Sep 07, 2006

      Mulyadi Oey says:

      This explains the permanent generation space option nicely.

      This explains the permanent generation space option nicely.

  5. Sep 10, 2007

    Jeremy Largman says:

    JBoss' environment variables are configured in run.conf, not run.sh, at least fo...

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

  6. Nov 05, 2007

    Abdelkader Boumediene says:

    Hi all,  Memory settings via tomcat commands seem do not work with Jira 3....

    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. Nov 05, 2007

      Peter White says:

      You can figure out the service name via regedit, via HKEY_LOCAL_MACHINE -> SO...

      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. Nov 20, 2007

      Bogdan Dziedzic says:

      JIRA service installed by the exe installer or thought command "service install"...

      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. Mar 05, 2008

    Timo Riikonen says:

    Is 1024 maximum setting for this? We got an error when we tried to increase mem...

    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. Jul 25, 2008

    Dan Gawarecki says:

    In the "Check available memory" section, the "Java VM Memory portion of the "Sys...

    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?

  9. Feb 20

    Daniel Zahn says:

    How can i get the values for "Free Memory" and "% Free" from the server console ...

    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. May 25

      Anonymous says:

      We do this with SNMP. There are some helpful articles on the web that can lead y...

      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

Add Comment


Except where otherwise noted, content in this space is licensed under a Creative Commons Attribution 2.5 Australia License.