JIRA 4.0 : Increasing JIRA Memory
This page last changed on Jul 07, 2009 by pkamal.
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:
Checking available memoryHow 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 memoryHow 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 ServiceIf 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).
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 UnixEdit 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 serversJava 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:
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 MemoryIn 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 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 -Xmx512m -XX:MaxPermSize=128m and then restart. Adjust 512 to the maximum memory you want to allocate. If bin\setenv.bat does not exist, create it. Tomcat on UnixEdit the bin/setenv.sh file and add: setenv.sh export JAVA_OPTS="-Xms256m -Xmx512m -XX:MaxPermSize=128m" and then restart. As mentioned above, for Windows services this is done by editing the service "Options" parameter in the registry: ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]() |
Document generated by Confluence on Oct 06, 2009 00:26 |