In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
What this article shares with you is about how to set up virtual memory in tomcat9. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
1 Server.xml configuration modification
Connector is a connector that receives requests from customers and sends response messages back to the client.
Open tomcat/conf/server.xml and find the following configuration
Modify to
Parameter description:
Org.apache.coyote.http11.Http11NioProtocol: adjust the working mode to Nio
MaxThreads: maximum number of threads. Default is 150. Increase the value to avoid too many queue requests, resulting in slow response.
MinSpareThreads: minimum number of idle threads.
AcceptCount: when the processing request exceeds this value, the subsequent request is placed in the queue to wait.
DisableUploadTimeout: disable upload timeout
ConnectionTimeout: connection timeout (in milliseconds). 0 means unlimited.
URIEncoding:URI address coding uses UTF-8
EnableLookups: turn off dns parsing to improve response time
Compression: enable compression
CompressionMinSize: minimum compression size (in Byte)
CompressibleMimeType: compressed file type
2 JVM optimization
Basic knowledge is required: stack memory, jvm garbage collector, jvm performance monitoring tools, ability to read gc logs, etc.
PermSize and MaxPermGen are no longer valid in JDK 1.8. The conclusion of permanent generation no longer exists in JDK 1.8and is replaced by metaspace.
Modify tomcat/bin/catalina.sh (reference configuration for machines with 8G memory):
JAVA_OPTS= "- Xms4G-Xmx4G-Xmn1024m-XX:MetaspaceSize=1024M-XX:MaxMetaspaceSize=1024M-XX:+UseConcMarkSweepGC-XX:+CMSClassUnloadingEnabled-XX:+HeapDumpOnOutOfMemoryError-verbose:gc-XX:+PrintGCDetails-XX:+PrintGCTimeStamps-XX:+PrintGCDateStamps-Xloggc:/appl/gc.log-XX:CMSInitiatingOccupancyFraction=75-XX:+UseCMSInitiatingOccupancyOnly"
-the heap memory initially allocated by Xms4G
-the maximum amount of heap memory that is allowed to be allocated by Xmx4G. These two are the same.
-the minimum heap memory that Xmn1024m is allowed to allocate.
-XX:MetaspaceSize=1024M initial meta-space size, which triggers garbage collection to unload types, and GC adjusts the value: if a large amount of space is freed, the value is reduced appropriately; if little space is freed, the value is increased appropriately when the MaxMetaspaceSize is not exceeded.
-XX:MaxMetaspaceSize=1024M
-XX:+UseConcMarkSweepGC concurrent tag cleanup (CMS) collector
-XX:+CMSClassUnloadingEnabled
-XX:+HeapDumpOnOutOfMemoryError means that when OOM occurs in JVM, the DUMP file is automatically generated.
The-XX:HeapDumpPath=$ {directory} parameter indicates the path where the DUMP file is generated, or you can specify a file name, for example:-XX:HeapDumpPath=$ {directory} / java_heapdump.hprof. If you do not specify a file name, the default is: java____heapDump.hprof.
-verbose:gc outputs GC logs.-XX:+PrintGC is the same as-verbose:gc. You can think of-verbose:gc as an alias for-XX:+PrintGC.
-XX:+PrintGCDetails prints GC details
-XX:+PrintGCTimeStamps prints gc timestamps
-XX:+PrintGCDateStamps
-Xloggc:/appl/gc.log defines the gc log directory
-XX:CMSInitiatingOccupancyFraction=75 means to set CMS to start GC when the memory occupancy rate reaches 75% (because CMS will have floating garbage, it usually starts GC earlier)
-XX:+UseCMSInitiatingOccupancyOnly only uses the set recycling threshold (75% specified above). If not specified, JVM only uses the set value for the first time, and then automatically adjusts it later.
Manage AJP port
AJP is a protocol customized for communication between Tomcat and HTTP server, which can provide high communication speed and efficiency. If the front end of the tomcat is apache, the connector AJP will be used. Since the front end of our company is a reverse proxy done by nginx, we do not use this connector, so we need to cancel the connector
The default Tomcat turns on hot deployment of war packages. In order to prevent malicious programs such as Trojans from being implanted, we have to turn off automatic deployment.
Modify the instance:
The above is how to set up virtual memory in tomcat9. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
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.