JVM-jmap
shell
-XX:+HeapDumpOnOutOfMemoryError -XX:ErrorFile=$HOME/logs/error.log -XX:HeapDumpPath=$HOME/logs/heap/heap_dump.hprof
jmap -dump:format=b,file=git.bin pid
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9004 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false
JVM 参数:
shell
@echo =================Server Start-----------------------
@echo off
set COMMAHND=java
set MAINCLASS=net.jvm.thread.WaitThread
set BOOT_LIB= lib/commens/commons-lang-2.5.jar;
set TYPE=-classpath "%BOOT_LIB%"
set JAVA_OPTS= -server -verbose:gc -Xmx64m -Xms64m -Xmn32m -XX:MaxPermSize=64m -XX:PermSize=64m -Xverify:none -XX:+PrintGCDetails -XX:SurvivorRatio=8 -XX:+DisableExplicitGC -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:CMSFullGCsBeforeCompaction=0 -XX:+CMSClassUnloadingEnabled -XX:-CMSParallelRemarkEnabled -XX:CMSInitiatingOccupancyFraction=90 -XX:+HandlePromotionFailure -Xloggc:log/gc.log -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port="9004" -Dcom.sun.management.jmxremote.authenticate="false" -Dcom.sun.management.jmxremote.ssl="false"
set ARGS=
@echo on
%COMMAHND% %JAVA_OPTS% %TYPE% %MAINCLASS% %ARGS%
pause
rem 可以在内存溢出时dump出内存快照
-XX:+HeapDumpOnOutOfMemeryError
-XX:HeapDumpPath=./
-Xmx1G -Xms1G -XX:MaxPermSize=256m -XX:PermSize=256m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9004 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -XX:+UseCompressedOops -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+CMSScavengeBeforeRemark -XX:+DisableExplicitGC -Djava.awt.headless=true -Xloggc:/opt/software/kafka/bin/../logs/kafkaServer-gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dkafka.logs.dir=/opt/software/kafka/bin/../logs -Dlog4j.configuration=file:bin/../config/log4j.properties
export SPARK_WORKER_OPTS="$SPARK_WORKER_OPTS -server -verbose:gc -Xmx1G -Xms1G -Xmn420M -XX:MaxPermSize=360m -XX:PermSize=360m -XX:+PrintGCDetails -XX:+DisableExplicitGC -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -Xloggc:$SPARK_HOME/logs/jvm-worker-gc.log