In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
1. Configuration optimization 1.1. Server.xml configuration [root@localhost ~] # cat server.xml. # the timeout of a customer connection. A value of-1 means there is no limit on the time it takes to establish a customer connection (in milliseconds). There are three ways for Tomcat IO to optimize Tomcat connectors: bio, nio and apr. Apr has the best performance and bio has the worst performance. BIO: synchronous and blocking, server implementation mode is one connection to one thread (default working mode) # NIO working mode NIO: synchronous non-blocking (above JDK1.4 version) # APR working mode APR: solve asynchronous IO problems from the operating system level and greatly improve performance JDK7 is supported, and you need to install an official plug-in to download yum-y install tomcat-native # using the http://tomcat.apache.org/native-doc/ # plug-in or install it using yum, in epel 1. 3. Context.xml [root@localhost ~] # cat context.xml# setting context maximum available cache cachingAllowed specifies that cache cacheMaxSize is allowed to be enabled to specify the maximum available cache. Default is 10m, per KB1.4. Catalina.properties [root@localhost ~] # cat catalina.properties# disables TLDs scanning tomcat.util.scan.StandardJarScanFilter.jarsToSkip = * 2. JVM optimization
JVM optimization mainly modifies the parameters of JAVA_OPTS and CATALINA_OPTS in catalina.sh scripts
JAVA_OPTS: a variable that sets JVM-related run parameters for Java runtime options start, stop, or run command execution
CATALINA_OPTS: a variable that sets Tomcat-related run parameters for the Java runtime option start, run command execution
JVM memory is divided into Cenozoic (Young Generation), old age (Old Generation) and permanent generation (Permanent Generation).
Heap memory (Heap) = new generation + old age, non-heap memory = permanent generation
CATALINA_OPTS= "${CATALINA_OPTS}-server-Xms6000M-Xmx6000M-Xss512k-XX:NewSize=2250M-XX:MaxNewSize=2250M-XX:+AggressiveOpts-XX:+UseBiasedLocking-XX:+DisableExplicitGC-XX:+UseParNewGC-XX:+UseConcMarkSweepGC-XX:MaxTenuringThreshold=15-XX:+CMSParallelRemarkEnabled-XX:LargePageSizeInBytes=128M-XX:+UseFastAccessorMethods-XX:+UseCMSInitiatingOccupancyOnly-Duser.timezone=Asia/Shanghai-Djava.awt.headless=true-Dfile.encoding=UTF8-Dsun.jnu.encoding=UTF8"-server starts slowly High runtime performance and memory management efficiency-clien startup speed is fast, runtime performance and memory management efficiency are low-Xms specifies Java initialization heap size,-Xms is set to the same value as-Xmx, to prevent JVM from repeatedly reapplying for memory. The default value is 64 of physical memory. Maximum limit for JVM to increase heap to-Xmx when free heap memory is less than 40%-Xmx specifies Java maximum heap size, maximum value is set to 80% of the maximum available memory, JVM reduces heap until-Xms minimum limit for free heap memory when free heap memory is greater than 70%-Xss specifies stack size for each Java thread The stack size of each thread is 1m, and it is not recommended to exceed the 1M-XX:NewSize specified Cenozoic memory size-XX:MaxNewSize specifies the maximum Cenozoic memory size-XX:+AggressiveOpts specifies whenever the JDK version is upgraded JVM will use the latest optimization technology-XX:+UseBiasedLocking specifies the optimized thread lock to automatically optimize thread processing-XX:+DisableExplicitGC specifies that the program code does not allow the display to call System.gc ()-XX:+UseConcMarkSweepGC to specify the old age as concurrent collection (CMS GC), CMS GC in the case of an increase in the number of GC The response time of each GC is very short (a few milliseconds)-XX:+UseParNewGC specifies that the new generation uses multi-thread parallel collection-XX:MaxTenuringThreshold specifies the maximum age of garbage, and sets it to 0. The new generation of objects do not pass through the Survivor area and go directly into the old age. For applications with a large number of applications in the old era (applications that require a lot of resident memory) can improve efficiency If the object is set to a large value, the new generation object will be replicated many times in the Survivor area, which can increase the survival time of the object in the new generation, increase the probability of being recycled in the new generation, and reduce the frequency of Full GC. This parameter is valid only when serial GC is used-when XX:+CMSParallelRemarkEnabled specifies the use of UseParNewGC, minimize the time of Mark. XX:LargePageSizeInBytes specifies the page size of Java Heap. The page size of memory cannot be set too large, which will affect the size of Perm.-XX:+UseFastAccessorMethods specifies to use Get, and the Set method converts the code to cost. Fast optimization of primitive types-XX:+UseCMSInitiatingOccupancyOnly specifies that Concurrent Collector starts collection after Oldgeneration uses the initialization ratio-Duser.timezone=Asia/Shanghai specifies time zone-Djava.awt.headless=true compatible Linux/Unix graphical report display output-Xmn specifies Cenozoic memory size, increasing Cenozoic generation will reduce the old age size It has a great impact on system performance. Sun officially recommends that the 3/8-XX:CMSInitiatingOccupancyFraction configured for the entire heap start garbage collection when the heap is full. Associated with Xmn, use-XX:+CMSIncrementalMode to specify that the incremental mode of CMS collector is enabled, and the incremental mode often pauses the CMS process. Make a complete concession to the application thread-XX:+UseSerialGC specifies the use of serial collectors, the old days use serial collections-XX:+UseParallelGC specifies the use of parallel collectors The new generation uses parallel collection-XX:+UseParallelOldGC to specify the old-age garbage collection mode for parallel collection-XX:ConcGCThreads specifies the number of threads when the concurrent CMS process runs, if not set JVM calculates the default number of parallel CMS threads based on the value of the-XX:ParallelGCThreads parameter in the parallel collector-XX:ParallelGCThreads specifies the number of threads in the parallel collector It is recommended that the configuration is equal to the number of CPU-XX:OldSize specifies the old memory size to set character set encoding:-Dfile.encoding=UTF8-Dsun.jnu.encoding=UTF8-Djavax.servlet.request.encoding=UTF-8-Djavax.servlet.response.encoding=UTF-8-Dfile.encoding=UTF-8-Duser.country=CN-Duser.language=zh
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.