In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to optimize the configuration of Tomcat, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
I. Tomcat memory optimization
Tomcat memory optimization is mainly to optimize tomcat startup parameters. We can set java_OPTS parameters in tomcat startup script catalina.sh.
JAVA_OPTS parameter description
Server server version of jdk enabled
-minimum memory for initialization of the Xms java virtual machine
-maximum memory available to the Xmx java virtual machine
-XX: PermSize memory permanently reserved area
-maximum permanent reserved area of XX:MaxPermSize memory
Server parameter configuration
At present, the memory of the company's server can generally be increased to a maximum of 2G, so the following configuration can be adopted:
JAVA_OPTS='-Xms1024m-Xmx2048m-XX: PermSize=256M-XX:MaxNewSize=256m-XX:MaxPermSize=256m'
Restart Tomcat after the configuration is completed, and check whether the configuration takes effect by using the following command:
First check the Tomcat process number:
Sudo lsof-iPUR 9027
We can see that the Tomcat process number is 12222.
Check to see if the configuration takes effect:
Sudo jmap-heap 12222
We can see that parameters such as MaxHeapSize are already in effect.
II. Tomcat concurrency optimization
Parameters related to 1.Tomcat connection
In the Tomcat configuration file server.xml
two。 Adjust the concurrency processing capability of connector connector
1 > Parameter description
Maximum number of threads requested by maxThreads customer
Number of socket threads created during minSpareThreads Tomcat initialization
Maximum number of idle socket threads for maxSpareThreads Tomcat connector
If enableLookups is set to true, domain name resolution is supported, and ip addresses can be resolved to host names.
RedirectPort forwards customer requests to SSL-based redirectPort ports where secure channels are needed
Maximum number of acceptAccount listening port queues. Customer requests will be rejected when they are full (not less than maxSpareThreads)
ConnectionTimeout connection timed out
Minimum number of processing threads when the minProcessors server is created
Maximum number of threads processed by maxProcessors server at a time
URIEncoding URL unified coding
2 > configuration examples in Tomcat
3.Tomcat cache optimization
1 > Parameter description
C ompression turns on compression function
CompressionMinSize enables compressed output content size, which defaults to 2KB.
CompressableMimeType compression type
ConnectionTimeout defines the timeout for establishing a customer connection. If-1, there is no limit on the time to establish a customer connection
2 > configuration examples in Tomcat
4. Reference configuration
1 > Old configuration
Refer to the network to configure the server as follows, share it:
Later, it was found that there was a performance bottleneck when the number of visitors reached more than 3 million.
2 > changed configuration
Thank you for reading this article carefully. I hope the article "how to optimize Tomcat configuration" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.