Java生产环境中应该配置的一些jvm参数
By:Roy.LiuLast updated:2018-09-18
java 应用程序部署在服务器上,应该具备一些基本的参数。下面分jdk1.8之前,以及 1.8之后分别列出来。以供以后参考
-server -Xms[g|m|k] -Xmx[g|m|k] -XX:PermSize=[g|m|k] -XX:MaxPermSize=[g|m|k] -Xmn[g|m|k] -XX:SurvivorRatio=-XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=-XX:+ScavengeBeforeFullGC -XX:+CMSScavengeBeforeRemark -XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:"" -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -Dsun.net.inetaddr.ttl=-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=`date`.hprof -Djava.rmi.server.hostname=-Dcom.sun.management.jmxremote.port=-Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false
jdk 1.8 之后的参数:
-server -Xms[g|m|k] -Xmx[g|m|k] -XX:MaxMetaspaceSize=[g|m|k] -Xmn[g|m|k] -XX:SurvivorRatio=-XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=-XX:+ScavengeBeforeFullGC -XX:+CMSScavengeBeforeRemark -XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:"" -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -Dsun.net.inetaddr.ttl=-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=`date`.hprof -Djava.rmi.server.hostname=-Dcom.sun.management.jmxremote.port=-Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false
里面最为特殊的,就是让JMX也可以工作,因为方便以后visualVM等远程连接操作。
From:一号门
Previous:JAVA性能监控与调优参考文档链接
COMMENTS