(under Windows) Tomcat optimization--memory, concurrency. Three aspects of cache optimization

Source: Internet
Author: User

A. Memory

Note:

The persistence state (storing constant, static variable area) configuration of-xx:permsize and-xx:maxpermsize is discarded in jdk1.8,

More than one metadata area (Metadata Space: Default is 0.2% of memory): So the parameter that sets the size of the metadata area also becomes corresponding metaspacesize and maxmetaspacesize.

  

Set java_opts=-server-xms2048m-xmx2048m-xss2m   -xx:metaspacesize=256m    -xx:maxnewsize=1024m

After you turn on Tomcat, use JPS to view the port occupancy:

Bootstrap is the Tomcat process number

  

Then use jmap-heap 20372 to view details

  

The display proves that the configuration was successful. Note: The JPS and JMAP commands must be configured with Java environment variables.

2. Configuration optimizations (concurrency)

Open the Tomcat installation directory \conf\server.xml file and navigate to this line:

<connector connectiontimeout= "20000" port= "8080" protocol= "http/1.1" redirectport= "8443"/>

This line is where our Tomcat container performance parameters are set, and it will generally have a default value that is far from being used by us, and we look at the configuration of this section after the change:

<ConnectorPort= "8080"Protocol= "http/1.1"MaxThreads= "+"minsparethreads= "+"Acceptcount= "+"MaxConnections= "+"ConnectionTimeout= "20000"maxhttpheadersize= "8192"Tcpnodelay= "true"Compression= "On"compressionminsize= "2048"Disableuploadtimeout= "true"Redirectport= "8443"enablelookups= "false"uriencoding= "UTF-8" />     

Configure the thread pool: Configure before connector under service tag

<!--thread pool--    <executor name= "Tomcatthreadpool"            nameprefix= "catalina-exec-"            maxthreads= "1000"            minsparethreads= "maxidletime="           60000 "           maxqueuesize=" Integer.max_value           " Prestartminsparethreads= "false"           threadpriority= "5"           classname= " Org.apache.catalina.core.StandardThreadExecutor "/>  

After the thread pool configuration is complete, refer to in connector:

  <connector      executor= "Tomcatthreadpool" ...

    

  

Reference Blog: http://blog.csdn.net/qq525099302/article/details/78396120

Https://www.cnblogs.com/redcreen/archive/2011/05/04/2037057.html

http://blog.csdn.net/u012562943/article/details/51441157

http://blog.csdn.net/wangyonglin1123/article/details/50986524

  

(under Windows) Tomcat optimization--memory, concurrency. Three aspects of cache optimization

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.