How do I change the JVM heap size for IG?
The purpose of this article is to provide information on changing the JVM heap size for IG. This article provides details for changing the JVM heap size on Linux®, Unix® and Windows® systems.
1 reader recommends this article
Overview
Changing the JVM heap size can improve performance and reduce the time it takes to process HTTP requests and responses. You should try different heap sizes to see what impact it has to determine the best heap size for your setup.
This article provides details on changing the JVM heap size depending on how you are running IG:
Changing the JVM heap size (Standalone mode)
When running IG in standalone mode, you need to use environment variables to set the JVM heap size as discussed in Configure Environment Variables and System Properties for IG in Standalone Mode.
To set the JVM heap size:
- Add a line similar to the following to the env.sh file: JVM_OPTS="-Xms256m -Xmx2048m"
- Restart IG.
Changing the JVM heap size (Web container mode)
The information given here is specific to the Apache Tomcat™ web container; you should make similar changes in the configuration file specific to your web container if you use a different one.
Note
It is recommended that you set the minimum and maximum heap sizes to the same value for best performance. Otherwise, the JVM runs a full Garbage Collector (GC) cycle when increasing its heap, during which time it can pause ongoing operations for up to a few seconds. Generally, a smaller heap will increase the frequency at which the JVM GC executes but reduce the duration; similarly, a larger heap will reduce the frequency and increase the duration. When tuning the JVM heap, the goal is to strike a balance between frequency and duration to reduce the impact of the GC on the application.
Unix® and Linux® systems
You can set the JVM heap size by specifying CATALINA_OPTS settings in the setenv.sh file (typically located in the /tomcat/bin/ directory). If this file doesn't exist, you should create it in the same directory as the catalina.sh file (also typically located in the /tomcat/bin/ directory).
For example, to set the minimum and maximum heap sizes to 2GB, you would add the following line to the setenv.sh file and restart the web container:
export CATALINA_OPTS="$CATALINA_OPTS -Xms2048m -Xmx2048m"Microsoft® Windows® systems
Providing you haven't installed Tomcat as a service, you can set the JVM heap size by specifying CATALINA_OPTS settings in the setenv.bat file (typically located in the /tomcat/bin/ directory). If this file doesn't exist, you should create it in the same directory as the catalina.bat file (also typically located in the /tomcat/bin/ directory).
For example, to set the minimum and maximum heap sizes to 2GB, you would add the following line to the setenv.bat file and restart the web container:
set CATALINA_OPTS=-Xms2048m -Xmx2048mIf you have installed Tomcat as a service on Windows, then you must use the GUI application to configure Tomcat services. This process refers to Tomcat 9, but will work for other versions by changing tomcat9w.exe in the command to match your version.
- Stop the Tomcat service.
- Navigate to \path\to\tomcat\bin\ from the command prompt:
- Enter the following command to display Tomcat Properties: tomcat9w.exe //ES//serviceNameWhere serviceName is the name of your Tomcat service.
- Navigate to the Java tab and complete the memory pool fields as follows: Initial memory pool: 2048 Maximum memory pool: 2048
- Restart the Tomcat service.
Alternatively, Windows system administrators may prefer to configure these options in the registry so that they may be configured via group policy. The initial memory pool and maximum memory pool values can be configured in the JvmMS and JvmMX properties under the following registry key for Tomcat 9:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Apache Software Foundation\Procrun 2.0\Tomcat9\Parameters\JavaSee Also
Best practice for JVM Tuning with G1 GC
Best practice for JVM Tuning with CMS GC
How do I enable Garbage Collector (GC) Logging for IG?
How do I collect JVM data for troubleshooting IG 6.x and 7.x?