Tomcat startup memory settings

Tomcat startup memory settings  

The startup of Tomcat is divided into startupo.bat startup and registration as the startup of the windows service, which are explained one by one below.

1.startup.bat start


Find catalina.bat in the tomcat_home / bin directory, open it with a text editor, and add the following line:

set JAVA_OPTS = -Xms1024M -Xmx1024M -XX: PermSize = 256M -XX: MaxNewSize = 256M -XX: MaxPermSize = 256M

Explain the parameters:

-Xms1024M: Initialize the heap memory size (note that if M is not added, the unit is KB)

-Xmx1029M: Maximum heap memory size

-XX: PermSize = 256M: Initialize class loading memory pool size

-XX: MaxPermSize = 256M: Maximum class loading memory pool size

-XX: MaxNewSize = 256M: This is unclear, there is a saying

There is also a -server parameter, which means that the server starts when the jvm is started, which is slower than the client, but the performance is better. You can choose it yourself.

2. The windows service starts


       If your tomcat is registered as a windows service and started as a service, the above method is invalid, because then tomcat starts to read the parameters of the registry instead of reading the parameters of the batch file. We have two ways to set jvm parameters.

The first is relatively simple, tomcat provides us with a form to set the startup parameters, double-click tomcat6w.exe in the tomcat_home / bin directory, as shown in the figure

Tomcat startup memory settings-insomnia alone-craving

The Initial memory pool below is the initial heap memory size, and the Maximun memory pool is the maximum heap memory size.

To set the size of the Perm Gen pool, you need to add parameters in the Java Option, add:

-Dcatalina.base =% tomcat_home%

-Dcatalina.home =% tomcat_home%

-Djava.endorsed.dirs =% tomcat_home% \ endorsed

-Djava.io.tmpdir =% tomcat_home% \ temp

-XX: PermSize = 256M

-XX: MaxPermSize = 256M

-XX: ReservedCodeCacheSize = 48M

-Duser.timezone = GMT + 08

(PS: There is no space after each line on the Internet, I have not tried it)

The second method is to open the registry-> HKEY_LOCAL_MACHINE \ SOFTWARE \ Apache Software Foundation \ Procrun 2.0 \ Tomcat6 \ Parameters \ Java (the path may be a little different)

Tomcat startup memory settings-insomnia alone-craving
Modify the value of Options and add the above parameters to OK. (Do n’t forget to back up the registry first)

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Hibernate Search - Elasticsearch with JSON manipulation

Spring Elasticsearch Operations