Tomcat performance tuning

Modify the JAVA_OPS parameter in catalina.sh as follows:

 

-Djava.awt.headless=true#Use java-PJA to process pictures

-Djava.net.preferIPv4Stack=true#On IPv6 network stacks that support IPv4 mapped addresses, IPv6 sockets can be used to connect to and accept connections from IPv4 and IPv6 hosts.

-Dcom.tc.productkey.path=/opt/tomcat/terracotta-license.key#BigMemory enable local cache to avoid triggering gc, storage address

-Dlocal.ip=10.10.4.35#local ip

-Djava.util.Arrays.useLegacyMergeSort=true#Compatible with sorting algorithms in older versions

-Djava.rmi.server.hostname=10.10.4.35#Configure RMI monitoring, specify IP for multi-NIC server when RMI is enabled

-Dcom.sun.management.jmxremote#Open tomcat jmx support

-Dcom.sun.management.jmxremote.port=1199#Specify the jmx port number

-Dcom.sun.management.jmxremote.ssl=false#Setting does not support ssl

-Dcom.sun.management.jmxremote.authenticate=false#Setting does not require authentication

-server

-Xmx8g# set the maximum heap size

-Xms8g#Set initial heap size

-Xmn1024m# young generation size whole JVM memory size = young generation size + old generation size + persistent generation size

-XX:SurvivorRatio=64m#Set the ratio of the persistent area to the survivor area in the young generation

-XX:MetaspaceSize=256m#Set the size of local memory allocated to class metadata

-XX:MaxMetaspaceSize=256m# Limit the maximum upper limit of local memory allocated to class metadata

-Xss256k# Set the size of each thread stack, the value is small, there are many threads, and the value is large, there are few threads

-XX:MaxDirectMemorySize=2G#BigMemory enable local cache to avoid triggering gc, maximum 2G

-XX:+HeapDumpOnOutOfMemoryError# When a memory overflow occurs, save the current heap in a file for future investigation

-XX:+PrintGCDetails #Print the details of GC occurrence

-XX:+PrintGCDateStamps #Print the time information of GC occurrence

-Xloggc:/opt/tomcat/logs/gc.log #Path of log generation

-XX:+UseGCLogFileRotation #Enable automatic dumping of GC log files

-XX:NumberOfGCLogFiles=5 #The number of cycles of GC log files

-XX:GCLogFileSize=50M #GC log file size

-XX:HeapDumpPath=/opt/tomcat/logs/java.hprof# specifies the storage path of the heap

-XX:+DisableExplicitGC#Disable code to manually call gc

-XX:+UseConcMarkSweepGC#Set concurrent collector

-XX:+CMSParallelRemarkEnabled#Reduce mark pause

-XX:+CMSConcurrentMTEnabled#Use concurrent CMSGC collector

-XX:+UseCMSCompactAtFullCollection# When using the concurrent collector, enable compression of the old generation

-XX:CMSFullGCsBeforeCompaction=1 #When the above configuration is enabled, how many times of Full GC is set here, the old generation will be compressed

-XX:LargePageSizeInBytes=64m#Memory paging-single page size setting-that is, setting large memory paging

-XX:+UseFastAccessorMethods#Fast optimizations - enable getter method optimizations for primitive types

-XX:+UseCMSInitiatingOccupancyOnly#Set the CMSGC collector to be running all the time

-XX:CMSInitiatingOccupancyFraction=70#Set garbage collection when CMSGC is 70% full

-XX:-OmitStackTraceInFastThrow#When the JVM detects that the program throws an exception repeatedly, it swallows the exception after executing it several times. Disable after specifying

-XX:+PrintCommandLineFlags# print configuration to log file

-XX:+UnlockCommercialFeatures#Enable JFR, enable resource management, enable J2SE commercial features

-XX:+FlightRecorder#Open JFR

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326865725&siteId=291194637