Adjust Tomcat startup parameters in Windows

Source: Internet
Author: User

Adjust Tomcat startup parameters in Windows
 
By default, Tomcat can use 128 MB of memory. This is not enough for applications with a large number of shards and relatively high memory consumption. You can adjust the startup parameters of the Java Virtual Machine to increase the memory available for Tomcat.
 
The following are two well-known parameters.
-Xms <size> JVM initialization heap size
-Xmx <size> maximum JVM heap Value
 
For example, if I want to set the initial memory size to 128 MB and the maximum usage is 1 GB, the following settings are used:
-Xms128m
-Xmx1024m
 
In Linux/Unix, you can add or modify JAVA_OPTS in {tomcat_dir}/bin/catalina. sh:
JAVA_OPTS = "-Xms128m-Xmx1024m"
 
In Windows, you can add or modify JAVA_OPTS in {tomcat_dir}/bin/catalina. bat:
Set JAVA_OPTS =-Xms128m-Xmx1024m
 
But I installed Tomcat 7 in the Service Startup version on Windows. It does not have the bin/catalina. bat file. How can I change it?
The answer is: Modify the registry.
 
Run regedit
Find the registry key: HKEY_LOCAL_MACHINE \ SOFTWARE \ Apache Software Foundation
Find Procrun 2.0 \ Tomcat7 \ Parameters \ Java
There is 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 it. Add the following two lines at the end:
-Xms128M
-Xmx1024M
Different Versions of Tomcat have different registry keys to be adjusted.
For example:
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
 
We hereby record it to readers.



Author: codingstandards

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.