Detail the implementation method of adjusting Tomcat startup parameters under Windows
- 2020-06-23 02:23:19
- OfStack
Adjust the Tomcat startup parameters under Windows
By default, Tomcat has 128MB, which is not enough for applications with a lot of access and a lot of memory. We can increase the amount of memory available for Tomcat by adjusting the startup parameters of the Java virtual machine.
The following two parameters are well known
-Xms<size> JVM Initializes the heap size
-Xmx<size> JVM Maximum heap size
For example, I want to set the initial memory size to 128M, up to 1G, as follows:
-Xms128m
-Xmx1024m
Under Linux/Unix, JAVA_OPTS can be achieved by adding or modifying JAVA_OPTS in {tomcat_dir}/bin/ catalina.sh:
JAVA_OPTS="-Xms128m -Xmx1024m"
The installation-free version of Windows can be achieved by adding or modifying JAVA_OPTS in {tomcat_dir}/bin/ catalina.bat:
set JAVA_OPTS=-Xms128m -Xmx1024m
But the service launcher Tomcat7 I installed on Windows doesn't have the bin/ catalina.bat file, so how do I change that?
The answer is: Modify the registry.
Run regedit
Find the registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation
Move on to Procrun 2.0\Tomcat7\Parameters\Java
There's an Options setting
-Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 7.0
-Dcatalina.base=C:\Program Files\Apache Software Foundation\Tomcat 7.0
-Djava.endorsed.dirs=C:\Program Files\Apache Software Foundation\Tomcat 7.0\endorsed
-Djava.io.tmpdir=C:\Program Files\Apache Software Foundation\Tomcat 7.0\temp
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=C:\Program Files\Apache Software Foundation\Tomcat 7.0\conf\logging.properties
Double-click it to edit and add the following two lines at the end:
-Xms128M
-Xmx1024M
Different versions of Tomcat require different registry keys to be adjusted
Such as:
Tomcat5 is
HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Tomcat Service Manager\Tomcat5\Parameters\JavaOptions
Tomcat6 is
HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\ Procrun 2.0\Tomcat6\Parameters\Java
Tomcat7 is
HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\ Procrun 2.0\Tomcat7\Parameters\Java
If you have any questions, please leave a message or go to this site community exchange discussion, thank you for reading, hope to help you, thank you for your support to this site!