Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Explain in detail the realization method of adjusting Tomcat startup parameters under Windows

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Adjust Tomcat startup parameters under Windows

By default, the memory that can be used by Tomcat is 128MB, which is not enough for applications with more visits and more memory-eating. We can increase the memory available to Tomcat by adjusting the startup parameters of the Java virtual machine.

Here are two well-known parameters

-Xms JVM initialization heap size-the maximum value of the Xmx JVM heap

For example, I want to set the initial memory size to 128m and take up 1G at most, which is the following setting:

-Xms128m-Xmx1024m

Under Linux/Unix, you can do this by adding or modifying JAVA_OPTS in {tomcat_dir} / bin/catalina.sh:

JAVA_OPTS= "- Xms128m-Xmx1024m"

In the installation-free version of Windows, you can do this by adding or modifying JAVA_OPTS in {tomcat_dir} / bin/catalina.bat:

Set JAVA_OPTS=-Xms128m-Xmx1024m

But the service startup version of Tomcat7, which I installed on Windows, does not have a bin/catalina.bat file, so how to change it?

The answer is: modify the registry.

Run regedit

Locate the registry key: HKEY_LOCAL_MACHINE\ SOFTWARE\ Apache Software Foundation

Then look for 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\ endorsed-Djava.io.tmpdir=C:\ Program Files\ Apache Software Foundation\ Tomcat 7\ temp-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager-Djava.util.logging.config.file=C:\ Program Files\ Apache Software Foundation\ Tomcat 7\ conf\ logging.properties

Double-click it to edit and add the following two lines at the end:

-Xms128M-Xmx1024M

Different versions of Tomcat need to adjust different registry entries

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

If you have any questions, please leave a message or go to the community to exchange and discuss, thank you for reading, hope to help you, thank you for your support!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report