Tomcat Memory Configuration for Windows
NOTE |
It is recommended to increase the Java heap size of Tomcat to avoid the initiation of garbage collection when memory usage hits the set threshold. The steps may vary depending on how Tomcat was deployed.
|
Steps:
1. Stop Tomcat.
2. Create a file named setenv.bat.
3. Place the file in the Tomcat bin folder.
4. Set the minimum and maximum heap size with the JVM–Xms and –Xmx parameters. A minimum of 1 GB is recommended. For example:
set JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding=UTF-8 -server -Xms512m -Xmx2g
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.
|
5. Save the file.
6. Restart Tomcat to apply the increase in the heap.