Tomcat - increase runtime memory and change GC (Garbage Collection) Algorithm Follow
Increasing the JVM memory allocation and thread stack size
Use one of the following procedures to increase the JVM memory allocation and thread stack size by using the Tomcat configuration tool or from the command line.
Note:
You must use the Tomcat configuration tool to configure these settings and restart Tomcat.
To increase the JVM memory allocation and thread stack size in the Tomcat configuration tool (Tomcat as a Service, on Windows)
- Right click on Apache Tomcat tray icon and stop the service (if running)
- Right click again on Apache Tomcat tray icon and click on Configure…
- Choose Java tab and increase the Initial memory pool and Maximum memory pool to the desired values.
Increase the JVM memory allocation and thread stack size for Tomcat from the command line (Windows)
- Stop the Tomcat (if running) by typing shutdown in the Tomcat bin directory (TomcatInstallDirectory/bin/shutdown.bat)
- Open the catalina.bat file located in the Tomcat bin directory (TomcatInstallDirectory/bin/catalina.bat) and add the following line (or the desired values):
set JAVA_OPTS=%JAVA_OPTS% -Xms256m -Xmx1024m
where:
- Xms is the initial (start) memory pool
- Xmx is the maximum memory pool
- Restart the Tomcat by typing startup in the Tomcat bin directory (TomcatInstallDirectory/bin/startup.bat)
Increase the JVM memory allocation and thread stack size for Tomcat (Linux)
- Stop Tomcat.
- Create a file named setenv.sh.
- Place the file in the Tomcat bin folder.
- Set the minimum and maximum heap size with the JVM–Xms and –Xmx parameters. A minimum of 1 GB is recommended. For example:
-
JAVA_OPTS="$JAVA_OPTS -Xms512m -Xmx2g -XX:+UseSerialGC"
-
where:
- Xms is the initial (start) memory pool
- Xmx is the maximum memory pool
- -XX:+UseSerialGC is an alternative Garbage Collection algorithm (recommended)
- NOTE: Setting the maximum value should be dependent on your system. Ensure that the heap size is not larger than the available free RAM on your system. It is recommended to use 80% of the available RAM not taken by the operating system or other processes of your JVM.
- Save the file.
- Start Tomcat to apply the increase in the heap.
Memory Allocated to the server
You can also see the memory allocated to the server where AuraPlayer is deployed from the Service Manager, in: Admin -> Server Information -> Used/Total Memory:
Change GC (Garbage Collection) Algorithm for improved Performance on high load
If you have high load on the AuraPlayer server, you can improve the JVM performance by changing the GC Algorithm.
On the same location that you set the memory parameters add the following:
-XX:+UseSerialGC
For Example:
set JAVA_OPTS=%JAVA_OPTS% -Xms256m -Xmx1024m -XX:+UseSerialGC
Comments
0 comments
Please sign in to leave a comment.