LINUXT and Windows Tomcat memory settings

Source: Internet
Author: User
Tags xms

Modify JVM memory size under Linux:


To add the catalina.sh file under TOMCAT's bin, locate Cygwin=false, and add the parameters in front of this line, as follows # VI tomcat_home/bin/catalina.sh ( default file contents )

Java_opts= "-server-xms800m-xmx800m-xx:permsize=256m-xx:maxpermsize=512m-xx:maxnewsize=512m"

The following is an additional setenv.sh file that you set up to set up Tomcat memory, add execute permissions to the file

#vi/opt/app/tomcat6/bin/setenv.sh export java_opts= "-server-xms512m-xmx1024m-xx:maxnewsize=512m-xx:permsize=128m -XX:MAXPERMSIZE=256M-XX:SURVIVORRATIO=14-XX:+USEPARALLELOLDGC "or modify the TOMCAT configuration file directly #vi tomcat_home/bin/ Catalina.shjava_opts= "-SERVER-XMS512M-XMX1024M-XX:MAXNEWSIZE=512M-XX:PERMSIZE=128M-XX:MAXPERMSIZE=256M-XX: SURVIVORRATIO=14-XX:+USEPARALLELOLDGC "


JVM parameter Description:

-server Be sure to enable the server version of the JDK as the first parameter, with good performance over multiple CPUs

-xms java heap Initial size. The default is 1/64 of physical memory.

-xmx Java heap maximum value. The recommendation is set to 80% of physical memory. Do not exceed physical memory.

-xmn Java heap minimum, typically set to one of the 3, 4 points of xmx.

-xx:permsize sets the initial size of the memory's permanent save area, and the default value is 64M.

-xx:maxpermsize set the maximum size of the memory's permanent storage, the default value is 64M.

The size of the-xx:survivorratio=2 survivor pool is 2 by default. If garbage collection becomes a bottleneck, you can try customizing the build pool settings

-xx:newsize the initial size of the newly generated pool. The default value is 2M.

-xx:maxnewsize the maximum size of the newly generated pool. The default value is 32M.

+xx:aggressiveheap lets the JVM ignore the xmx parameter, frantically eats a g of physical memory and eats a G swap.

-XSS stack size per thread

-VERBOSE:GC Reality Garbage Collection Information

-xloggc:gc.log specifying garbage collection log files

-XX:+USEPARNEWGC shortening the time of minor collection

-XX:+USECONCMARKSWEEPGC shortening the time of major collection

-XX:USERPARNEWGC can be used to set up parallel collection (multi-CPU)

-xx:parallelgcthreads can be used to increase the degree of parallelism (multi-CPU)

-XX:USEPARALLELGC can be set with a parallel purge collector (multi-CPU)

-XX:+USEPARALLELOLDGC: Configure the old Generation garbage collection method for parallel collection. JDK6.0 supports parallel collection of older generations.



Modify JVM memory size under windows:


Scenario One: Unzip the version of Tomcat to launch Tomcat via Startup.bat to load the configuration


To add a catalina.bat under Tomcat's Bin, rem Guess catalina_home if not defined

Add after set current_dir=%cd%:

Set java_opts= "-server-xms800m-xmx3072m-xx:permsize=512m-xx:maxnewsize=256m-xx:maxpermsize=1024m"



Another note (detailed explanation):

Common JVM Parameter Configuration rollup

Heap Settings

-XMS: initial Heap Size


-XMX: Maximum Heap Size


-xx:newsize=n: Setting the young generation size


-xx:newratio=n: Sets the ratio of the younger generation to the older generation. such as: 3, the ratio of the young generation and the old generation is 1:3, the young generation of the entire young generation of old generation and 1/4


-xx:survivorratio=n: The ratio of Eden in the young generation to the two survivor districts. Note that there are two survivor districts. such as: 3, indicates Eden:


Survivor=3:2, a Survivor area accounted for 1/5 of the entire young generation.


-xx:maxpermsize=n: Setting the persistent generation size


Collector Settings

-XX:+USESERIALGC: Setting up the serial collector


-XX:+USEPARALLELGC: Setting up a parallel collector


-XX:+USEPARALLEDLOLDGC: Setting up a parallel old generation collector


-XX:+USECONCMARKSWEEPGC: Setting the concurrency Collector


Garbage collection Statistics

-xx:+printgc


-xx:+printgcdetails


-xx:+printgctimestamps


-xloggc:filename


Parallel collector settings

-xx:parallelgcthreads=n: Sets the number of CPUs to use when the parallel collector is collected. The number of parallel collection threads.


-xx:maxgcpausemillis=n: Set maximum pause time for parallel collection


-xx:gctimeratio=n: Sets the percentage of time that garbage collection takes to run the program. The formula is 1/(1+n)


Concurrent collector Settings

-xx:+cmsincrementalmode: Set to incremental mode. Applies to single CPU conditions.


-xx:parallelgcthreads=n: Set the concurrency collector the number of CPUs used by the young generation collection method for parallel collection. The number of parallel collection threads.


This article is from "Operation and maintenance record Mei Ling" blog, please be sure to keep this source http://meiling.blog.51cto.com/6220221/1655007

LINUXT and Windows Tomcat memory settings

Related Article

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.