In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly talks about "what is the method of Tomcat tuning and JVM parameter optimization". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "what is the method of Tomcat tuning and JVM parameter optimization?"
Tomcat
About what Tomcat is, I believe you are no stranger to development, server, Web application server, a lightweight application server, in small and medium-sized systems and concurrent access users are not many occasions is widely used, is the first choice for the development and debugging of JSP programs.
In our daily development, maybe a large part of us just know how to use the Tomcat server, but we don't know how to adjust the various configuration parameters in Tomcat so that Tomcat can run better, so listen to Ah Fan to introduce it to you.
Profile modification and optimization
The general directory of Tomcat under Windows is the directory we downloaded and decompressed, that is, ${TOMCAT_HOME}, like this D:\ develop\ tomcat\ apache-tomcat-7.0.88, and his configuration file is the server.xml file under conf, and it must be the contents of this file that we need to tune.
Let's start with the analysis from Connector:
Connector: connector, which is responsible for receiving customer requests and sending response messages back to the client
In fact, what we optimize for Connector is our concurrency ability when we access requests, and concurrency is often a problem that we need to consider in our work, and what can we configure in this connector?
The most commonly used thing we use is to configure a unified coding format of URL, for example, we configure a coding format of UTF-8 in it.
URIEncoding: URIEncoding = UTF-8
Executor: specify the actuator (thread pool) to be used for this connector
ConnectionTimeout: connection timeout
MaxThreads: maximum number of threads requested by the customer
MinSpareThreads: the number of threads created during Tomcat initialization, threads that will run all the time
MaxSpareThreads: the maximum number of idle threads for the Tomcat connector
MinProcessors: the minimum number of processing threads when the server is created
MaxProcessors: maximum number of threads processed by the server at the same time
EnableLookups: if set to true, domain name resolution is supported. Ip addresses can be used to resolve host names. In order to reduce performance consumption, we sometimes turn it off.
RedirectPort: forward customer requests to SSL-based redirectPort ports where secure channels are needed
AcceptAccount: the maximum number of listening port queues. Customer requests will be rejected when they are full (not less than maxSpareThreads)
And what we usually match most often is URIEncoding and rarely changes other configurations, but in the interview, we certainly won't ask you to optimize the coding format, but we must modify other things about the maximum number of processing threads and domain name resolution.
And our final configuration is no longer the above code, but becomes optimized:
NIO and BIO and NIO2.
In fact, NIO, BIO and AIO have been completely mentioned before. Synchronous blocking IO is BIO, synchronous non-blocking IO and asynchronous blocking IO are NIO, and asynchronous non-blocking IO is AIO.
BIO: synchronous blocking IO
NIO: synchronous non-blocking IO and asynchronous blocking IO
AIO: this kind of asynchronous non-blocking IO is what we need to pay attention to most and is supported from JDK7 and above.
Do not say much, directly on how to modify
Some people on the Internet say that from Tomcat8 to above is NIO mode, but the actual situation does not seem to be, you still need to manually change to NIO mode.
With regard to the optimization of Tomcat, A Fan will no longer give you a description, but will tell you about the optimization of JVM.
JVM
When A Fan first wrote an article, it was first written from JVM. You can search for the content that A Fan once wrote about JVM, which contains a complete introduction to JVM, FullGC, YGC and other garbage collection methods. Here, A Fan only introduces how to modify the configuration of Tomcat to achieve our optimization of JVM.
As we all know, choosing different GC strategies correctly and adjusting the parameters of JVM and GC can greatly reduce the work of GC, but this will greatly improve the efficiency of our program.
The directory is the same as that directory, the bin directory under the root of Tomcat, catalina.bat, Linux, you can modify the .sh file.
Find JAVA_OPTS and he is used to set the variables related to the running parameters of JVM. Here, A Fan also tells you about the parameter properties of JVM, otherwise you can't change it directly, it's prone to accidents.
-Xms: initial heap size physical memory 1x64 (
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.