tomcat配置jvm参数不建议直接在bin/catalina.sh里面配置,而是写在bin/setenv.sh里,没有就新建一个,文件读权限自行配置.
例如:
export CATALINA_OPTS=“ C A T A L I N A _ O P T S − X m s 1024 m − X m x 4096 m " e x p o r t C A T A L I N A _ O P T S = " CATALINA\_OPTS -Xms1024m -Xmx4096m" export CATALINA\_OPTS=" CATALINA_OPTS−Xms1024m−Xmx4096m"exportCATALINA_OPTS="CATALINA_OPTS -XX:+PrintGCDetails -XX:+PrintHeapAtGC -XX:+PrintGCDateStamps - Xloggc:gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=100 -XX:GCLogFileSize=1M”
PrintGCDetails:打印GC详情(年轻代gc,老年代gc,元空间gc)
PrintHeapAtGC:打印堆gc详情(eden,from,to,老年代,元空间)
PrintGCDateStamps:打印当前时间戳
log相关是打印滚动gc文件
启动tomcat:ps -ef | grep tomcat 会看见配置的参数
详情:https://crunchify.com/how-to-change-jvm-heap-setting-xms-xmx-of-tomcat/