server.xml 配置(注意版本)
https://tomcat.apache.org/tomcat-9.0-doc/config/http.html
setenv.bat
rem set "JAVA_OPTS=%JAVA_OPTS% -Xms8G -Xmx8G -XX:PermSize=512M -XX:MaxNewSize=512M -XX:MaxPermSize=512M -server -Dfile.encoding=UTF-8" rem ================================================================== rem discourage address map swapping by setting Xms and Xmx to the same value rem http://confluence.atlassian.com/display/DOC/Garbage+Collector+Performance+Issues set "JAVA_OPTS=%JAVA_OPTS% -Xms10g" set "JAVA_OPTS=%JAVA_OPTS% -Xmx10g" rem Increase maximum perm size for web base applications to 4x the default amount rem http://wiki.apache.org/tomcat/FAQ/Memoryhttp://wiki.apache.org/tomcat/FAQ/Memory set "JAVA_OPTS=%JAVA_OPTS% -XX:MaxMetaspaceSize=1g" rem Reset the default stack size for threads to a lower value (by 1/10th original) rem By default this can be anywhere between 512k -> 1024k depending on x32 or x64 rem bit Java version. rem http://www.springsource.com/files/uploads/tomcat/tomcatx-large-scale-deployments.pdf rem http://www.oracle.com/technetwork/java/hotspotfaq-138619.html set "JAVA_OPTS=%JAVA_OPTS% -Xss228k" rem Oracle Java as default, uses the serial garbage collector on the rem Full Tenured heap. The Young space is collected in parallel, but the rem Tenured is not. This means that at a time of load if a full collection rem event occurs, since the event is a 'stop-the-world' serial event then rem all application threads other than the garbage collector thread are rem taken off the CPU. This can have severe consequences if requests continue rem to accrue during these 'outage' periods. (specifically webservices, webapps) rem [Also enables adaptive sizing automatically] set "JAVA_OPTS=%JAVA_OPTS% -XX:+UseParallelGC" rem This is interpreted as a hint to the garbage collector that pause times rem of <nnn> milliseconds or less are desired. The garbage collector will rem adjust the Java heap size and other garbage collection related parameters rem in an attempt to keep garbage collection pauses shorter than <nnn> milliseconds. rem http://java.sun.com/docs/hotspot/gc5.0/ergo5.html set "JAVA_OPTS=%JAVA_OPTS% -XX:MaxGCPauseMillis=1500" rem A hint to the virtual machine that it.s desirable that not more than: rem 1 / (1 + GCTimeRation) of the application execution time be spent in rem the garbage collector. rem http://themindstorms.wordpress.com/2009/01/21/advanced-jvm-tuning-for-low-pause/ set "JAVA_OPTS=%JAVA_OPTS% -XX:GCTimeRatio=9 -XX:+UseAdaptiveSizePolicy" rem file encoding set "JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding=UTF-8" rem The hotspot server JVM has specific code-path optimizations rem which yield an approximate 10% gain over the client version. set "JAVA_OPTS=%JAVA_OPTS% -server" rem Disable remote (distributed) garbage collection by Java clients rem and remove ability for applications to call explicit GC collection set "JAVA_OPTS=%JAVA_OPTS% -XX:+DisableExplicitGC" rem out of memory dump set "JAVA_OPTS=%JAVA_OPTS% -XX:+HeapDumpOnOutOfMemoryError" set "JAVA_OPTS=%JAVA_OPTS% -XX:HeapDumpPath=%CATALINA_BASE%\heapdump\ppm.hprof"
setenv.sh
#! /bin/sh # ================================================================== # discourage address map swapping by setting Xms and Xmx to the same value # http://confluence.atlassian.com/display/DOC/Garbage+Collector+Performance+Issues export CATALINA_OPTS="$CATALINA_OPTS -Xms4g" export CATALINA_OPTS="$CATALINA_OPTS -Xmx4g" # Increase maximum perm size for web base applications to 4x the default amount # http://wiki.apache.org/tomcat/FAQ/Memoryhttp://wiki.apache.org/tomcat/FAQ/Memory export CATALINA_OPTS="$CATALINA_OPTS -XX:MaxMetaspaceSize=1g" # Reset the default stack size for threads to a lower value (by 1/10th original) # By default this can be anywhere between 512k -> 1024k depending on x32 or x64 # bit Java version. # http://www.springsource.com/files/uploads/tomcat/tomcatx-large-scale-deployments.pdf # http://www.oracle.com/technetwork/java/hotspotfaq-138619.html export CATALINA_OPTS="$CATALINA_OPTS -Xss228k" # Oracle Java as default, uses the serial garbage collector on the # Full Tenured heap. The Young space is collected in parallel, but the # Tenured is not. This means that at a time of load if a full collection # event occurs, since the event is a 'stop-the-world' serial event then # all application threads other than the garbage collector thread are # taken off the CPU. This can have severe consequences if requests continue # to accrue during these 'outage' periods. (specifically webservices, webapps) # [Also enables adaptive sizing automatically] export CATALINA_OPTS="$CATALINA_OPTS -XX:+UseParallelGC" # This is interpreted as a hint to the garbage collector that pause times # of <nnn> milliseconds or less are desired. The garbage collector will # adjust the Java heap size and other garbage collection related parameters # in an attempt to keep garbage collection pauses shorter than <nnn> milliseconds. # http://java.sun.com/docs/hotspot/gc5.0/ergo5.html export CATALINA_OPTS="$CATALINA_OPTS -XX:MaxGCPauseMillis=1500" # A hint to the virtual machine that it.s desirable that not more than: # 1 / (1 + GCTimeRation) of the application execution time be spent in # the garbage collector. # http://themindstorms.wordpress.com/2009/01/21/advanced-jvm-tuning-for-low-pause/ export CATALINA_OPTS="$CATALINA_OPTS -XX:GCTimeRatio=9 -XX:+UseAdaptiveSizePolicy" # The hotspot server JVM has specific code-path optimizations # which yield an approximate 10% gain over the client version. export CATALINA_OPTS="$CATALINA_OPTS -server" # Disable remote (distributed) garbage collection by Java clients # and remove ability for applications to call explicit GC collection export CATALINA_OPTS="$CATALINA_OPTS -XX:+DisableExplicitGC" #out of memory dump export CATALINA_OPTS="$CATALINA_OPTS -XX:+HeapDumpOnOutOfMemoryError" export CATALINA_OPTS="$CATALINA_OPTS -XX:HeapDumpPath=/root/heapdump/ppm.hprof" # Check for application specific parameters at startup if [ -r "$CATALINA_BASE/bin/appenv.sh" ]; then . "$CATALINA_BASE/bin/appenv.sh" fi echo "Using CATALINA_OPTS:" for arg in $CATALINA_OPTS do echo ">> " $arg done echo "" echo "Using JAVA_OPTS:" for arg in $JAVA_OPTS do echo ">> " $arg done echo "_______________________________________________" echo ""
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/198806.html