jvm配置示例

java 
    -XX:+UseG1GC 
    -XX:MaxGCPauseMillis=100 
    -XX:InitiatingHeapOccupancyPercent=45 
    -XX:G1HeapRegionSize=16m 
    -XX:+ParallelRefProcEnabled 
    -XX:MaxTenuringThreshold=3 
    -XX:+AlwaysPreTouch 
    -Xmx4096M 
    -Xms4096M 
    -Xmn2048M 
    -XX:MaxMetaspaceSize=256M 
    -XX:MetaspaceSize=256M 
    -XX:MaxDirectMemorySize=100M 
    -XX:ReservedCodeCacheSize=268435456 
    -XX:-OmitStackTraceInFastThrow 
    -Djava.security.egd=file:/dev/./urandom 
    -verbose:gc 
    -XX:+PrintGCDetails 
    -XX:+PrintGCDateStamps 
    -XX:+PrintGCApplicationStoppedTime 
    -XX:+PrintGCApplicationConcurrentTime  
    -XX:+PrintTenuringDistribution 
    -XX:+PrintClassHistogramBeforeFullGC 
    -XX:+PrintClassHistogramAfterFullGC 
    -Xloggc:/tmp/logs/gc_%p.log 
    -XX:+HeapDumpOnOutOfMemoryError 
    -XX:HeapDumpPath=/tmp/logs 
    -XX:ErrorFile=/tmp/logs/hs_error_pid%p.log 
    -Djava.rmi.server.hostname=127.0.0.1 
    -Dcom.sun.management.jmxremote 
    -Dcom.sun.management.jmxremote.port=14000 
    -Dcom.sun.management.jmxremote.ssl=false 
    -Dcom.sun.management.jmxremote.authenticate=false 
    -javaagent:/opt/test.jar 
    MainRun
原文地址:https://www.cnblogs.com/muzhongjiang/p/15160750.html