JVM调优中经常用到的几个命令
2017-09-13 12:28
435 查看
jcmd-查找jvm进程信息
jcmd命令默认是查找jvm进程信息,也可以执行相关的jvm命令。帮助信息
F:\soft\Java\jdk1.8\bin>jcmd -h Usage: jcmd <pid | main class> <command ...|PerfCounter.print|-f file> or: jcmd -l or: jcmd -h command must be a valid jcmd command for the selected jvm. Use the command "help" to see which commands are available. If the pid is 0, commands will be sent to all Java processes. The main class argument will be used to match (either partially or fully) the class used to start Java. If no options are given, lists Java processes (same as -p). PerfCounter.print display the counters exposed by this process -f read and execute commands from the file -l list JVM processes on the local machine -h this help
使用实例 1
F:\soft\Java\jdk1.8\bin>jcmd 3068 sun.tools.jcmd.JCmd
使用示例 2
使用命令:jcmd 9816 PerfCounter.print
可详细打印对应java进程的有效性能计数器(performance counters)。
9816: java.ci.totalTime=106668 java.cls.loadedClasses=639 java.cls.sharedLoadedClasses=0 java.cls.sharedUnloadedClasses=0 java.cls.unloadedClasses=0 java.property.java.class.path="boss-1.0.1.jar" java.property.java.endorsed.dirs="F:\soft\Java\jre1.8\lib\endorsed" java.property.java.ext.dirs="F:\soft\Java\jre1.8\lib\ext;C:\Windows\Sun\Java\lib\ext" java.property.java.home="F:\soft\Java\jre1.8" java.property.java.library.path="C:\ProgramData\Oracle\Java\javapath;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\soft\svn\bin;F:\soft\Java\jdk1.8\bin;E:\DTool\sdk\platform-tools;E:\DTool\sdk\tools;%MAVEN_HOME%\bin;D:\apache-maven-3.3.9\bin;D:\soft\MySQL\MySQLServer\bin;D:\as\gradle\gradle-2.14.1\bin;H:\php56\;H:\php56\ext;H:\DownLoad\apache-ant-1.10.1\bin;F:\Program Files\Git\cmd;F:\Program Files\Git\mingw64\bin;F:\Program Files\Git\usr\bin;F:\Program Files\VisualSVN Server\bin;F:\soft\python3;F:\Program Files (x86)\AllWinnerTech\PhoenixSuit\;." java.property.java.version="1.8.0_101" java.property.java.vm.info="mixed mode" java.property.java.vm.name="Java HotSpot(TM) 64-Bit Server VM" java.property.java.vm.specification.name="Java Virtual Machine Specification" java.property.java.vm.specification.vendor="Oracle Corporation" java.property.java.vm.specification.version="1.8" java.property.java.vm.vendor="Oracle Corporation" java.property.java.vm.version="25.101-b13" java.rt.vmArgs="" java.rt.vmFlags="" java.threads.daemon=4 java.threads.live=11 java.threads.livePeak=11 java.threads.started=12 sun.ci.compilerThread.0.compiles=8 sun.ci.compilerThread.0.method="" sun.ci.compilerThread.0.time=4 sun.ci.compilerThread.0.type=1 sun.ci.compilerThread.1.compiles=4 sun.ci.compilerThread.1.method="" sun.ci.compilerThread.1.time=3 sun.ci.compilerThread.1.type=1 sun.ci.compilerThread.2.compiles=97 sun.ci.compilerThread.2.method="" sun.ci.compilerThread.2.time=10 sun.ci.compilerThread.2.type=1 sun.ci.lastFailedMethod="" sun.ci.lastFailedType=0 sun.ci.lastInvalidatedMethod="" sun.ci.lastInvalidatedType=0 sun.ci.lastMethod="sun/misc/ASCIICaseInsensitiveComparator compare" sun.ci.lastSize=264 sun.ci.lastType=1 sun.ci.nmethodCodeSize=100000 sun.ci.nmethodSize=167824 sun.ci.osrBytes=0 sun.ci.osrCompiles=0 sun.ci.osrTime=0 sun.ci.standardBytes=7514 sun.ci.standardCompiles=109 sun.ci.standardTime=106668 sun.ci.threads=3 sun.ci.totalBailouts=0 sun.ci.totalCompiles=109 sun.ci.totalInvalidates=0 sun.classloader.findClassTime=24540700 sun.classloader.findClasses=46 sun.classloader.parentDelegationTime=3007529 sun.cls.appClassBytes=137124 sun.cls.appClassLoadCount=106 sun.cls.appClassLoadTime=53848 sun.cls.appClassLoadTime.self=24776 sun.cls.classInitTime=124090 sun.cls.classInitTime.self=77927 sun.cls.classLinkedTime=74692 sun.cls.classLinkedTime.self=28333 sun.cls.classVerifyTime=46283 sun.cls.classVerifyTime.self=15996 sun.cls.defineAppClassTime=19317 sun.cls.defineAppClassTime.self=760 sun.cls.defineAppClasses=46 sun.cls.initializedClasses=500 sun.cls.isUnsyncloadClassSet=0 sun.cls.jniDefineClassNoLockCalls=0 sun.cls.jvmDefineClassNoLockCalls=46 sun.cls.jvmFindLoadedClassNoLockCalls=212 sun.cls.linkedClasses=588 sun.cls.loadInstanceClassFailRate=0 sun.cls.loadedBytes=1298848 sun.cls.lookupSysClassTime=26691 sun.cls.methodBytes=830360 sun.cls.nonSystemLoaderLockContentionRate=0 sun.cls.parseClassTime=90729 sun.cls.parseClassTime.self=77100 sun.cls.sharedClassLoadTime=25 sun.cls.sharedLoadedBytes=0 sun.cls.sharedUnloadedBytes=0 sun.cls.sysClassBytes=2114821 sun.cls.sysClassLoadTime=122868 sun.cls.systemLoaderLockContentionRate=0 sun.cls.time=265053 sun.cls.unloadedBytes=0 sun.cls.unsafeDefineClassCalls=0 sun.cls.verifiedClasses=559 sun.gc.cause="No GC" sun.gc.collector.0.invocations=0 sun.gc.collector.0.lastEntryTime=0 sun.gc.collector.0.lastExitTime=0 sun.gc.collector.0.name="PSScavenge" sun.gc.collector.0.time=0 sun.gc.collector.1.invocations=0 sun.gc.collector.1.lastEntryTime=0 sun.gc.collector.1.lastExitTime=0 sun.gc.collector.1.name="PSParallelCompact" sun.gc.collector.1.time=0 sun.gc.compressedclassspace.capacity=393216 sun.gc.compressedclassspace.maxCapacity=1073741824 sun.gc.compressedclassspace.minCapacity=0 sun.gc.compressedclassspace.used=77664 sun.gc.generation.0.capacity=44564480 sun.gc.generation.0.maxCapacity=706740224 sun.gc.generation.0.minCapacity=44564480 sun.gc.generation.0.name="new" sun.gc.generation.0.space.0.capacity=34078720 sun.gc.generation.0.space.0.initCapacity=0 sun.gc.generation.0.space.0.maxCapacity=705691648 sun.gc.generation.0.space.0.name="eden" sun.gc.generation.0.space.0.used=6151536 sun.gc.generation.0.space.1.capacity=5242880 sun.gc.generation.0.space.1.initCapacity=0 sun.gc.generation.0.space.1.maxCapacity=235405312 sun.gc.generation.0.space.1.name="s0" sun.gc.generation.0.space.1.used=0 sun.gc.generation.0.space.2.capacity=5242880 sun.gc.generation.0.space.2.initCapacity=0 sun.gc.generation.0.space.2.maxCapacity=235405312 sun.gc.generation.0.space.2.name="s1" sun.gc.generation.0.space.2.used=0 sun.gc.generation.0.spaces=3 sun.gc.generation.1.capacity=89653248 sun.gc.generation.1.maxCapacity=1413480448 sun.gc.generation.1.minCapacity=89653248 sun.gc.generation.1.name="old" sun.gc.generation.1.space.0.capacity=89653248 sun.gc.generation.1.space.0.initCapacity=89653248 sun.gc.generation.1.space.0.maxCapacity=1413480448 sun.gc.generation.1.space.0.name="old" sun.gc.generation.1.space.0.used=0 sun.gc.generation.1.spaces=1 sun.gc.lastCause="No GC" sun.gc.metaspace.capacity=4587520 sun.gc.metaspace.maxCapacity=1082130432 sun.gc.metaspace.minCapacity=0 sun.gc.metaspace.used=764080 sun.gc.policy.avgBaseFootprint=0 sun.gc.policy.avgMajorIntervalTime=0 sun.gc.policy.avgMajorPauseTime=0 sun.gc.policy.avgMinorIntervalTime=0 sun.gc.policy.avgMinorPauseTime=0 sun.gc.policy.avgOldLive=0 sun.gc.policy.avgPretenuredPaddedAvg=0 sun.gc.policy.avgPromotedAvg=34078720 sun.gc.policy.avgPromotedDev=0 sun.gc.policy.avgPromotedPaddedAvg=34078720 sun.gc.policy.avgSurvivedAvg=5242880 sun.gc.policy.avgSurvivedDev=0 sun.gc.policy.avgSurvivedPaddedAvg=5242880 sun.gc.policy.avgYoungLive=0 sun.gc.policy.boundaryMoved=0 sun.gc.policy.changeOldGenForMajPauses=0 sun.gc.policy.changeOldGenForMinPauses=0 sun.gc.policy.changeYoungGenForMajPauses=0 sun.gc.policy.changeYoungGenForMinPauses=0 sun.gc.policy.collectors=2 sun.gc.policy.decideAtFullGc=0 sun.gc.policy.decreaseForFootprint=0 sun.gc.policy.decrementTenuringThresholdForGcCost=0 sun.gc.policy.decrementTenuringThresholdForSurvivorLimit=0 sun.gc.policy.desiredSurvivorSize=0 sun.gc.policy.edenSize=34078720 sun.gc.policy.freeSpace=68157440 sun.gc.policy.fullFollowsScavenge=0 sun.gc.policy.gcTimeLimitExceeded=0 sun.gc.policy.generations=3 sun.gc.policy.increaseOldGenForThroughput=0 sun.gc.policy.increaseYoungGenForThroughput=0 sun.gc.policy.incrementTenuringThresholdForGcCost=0 sun.gc.policy.liveAtLastFullGc=34078720 sun.gc.policy.liveSpace=0 sun.gc.policy.majorCollectionSlope=0 sun.gc.policy.majorGcCost=0 sun.gc.policy.majorPauseOldSlope=0 sun.gc.policy.majorPauseYoungSlope=0 sun.gc.policy.maxTenuringThreshold=15 sun.gc.policy.minorCollectionSlope=0 sun.gc.policy.minorGcCost=0 sun.gc.policy.minorPauseOldSlope=0 sun.gc.policy.minorPauseTime=0 sun.gc.policy.minorPauseYoungSlope=0 sun.gc.policy.mutatorCost=1 sun.gc.policy.name="ParScav:MSC" sun.gc.policy.oldCapacity=134217728 sun.gc.policy.oldEdenSize=34078720 sun.gc.policy.oldPromoSize=34078720 sun.gc.policy.promoSize=34078720 sun.gc.policy.promoted=0 sun.gc.policy.scavengeSkipped=0 sun.gc.policy.survived=0 sun.gc.policy.survivorOverflowed=0 sun.gc.policy.tenuringThreshold=15 sun.gc.policy.youngCapacity=39321600 sun.gc.tlab.alloc=0 sun.gc.tlab.allocThreads=0 sun.gc.tlab.fastWaste=0 sun.gc.tlab.fills=0 sun.gc.tlab.gcWaste=0 sun.gc.tlab.maxFastWaste=0 sun.gc.tlab.maxFills=0 sun.gc.tlab.maxGcWaste=0 sun.gc.tlab.maxSlowAlloc=0 sun.gc.tlab.maxSlowWaste=0 sun.gc.tlab.slowAlloc=0 sun.gc.tlab.slowWaste=0 sun.os.hrt.frequency=3117841 sun.os.hrt.ticks=112459180 sun.perfdata.majorVersion=2 sun.perfdata.minorVersion=0 sun.perfdata.overflow=0 sun.perfdata.size=65536 sun.perfdata.timestamp=201939 sun.perfdata.used=17616 sun.property.sun.boot.class.path="F:\soft\Java\jre1.8\lib\resources.jar;F:\soft\Java\jre1.8\lib\rt.jar;F:\soft\Java\jre1.8\lib\sunrsasign.jar;F:\soft\Java\jre1.8\lib\jsse.jar;F:\soft\Java\jre1.8\lib\jce.jar;F:\soft\Java\jre1.8\lib\charsets.jar;F:\soft\Java\jre1.8\lib\jfr.jar;F:\soft\Java\jre1.8\classes" sun.property.sun.boot.library.path="F:\soft\Java\jre1.8\bin" sun.rt._sync_ContendedLockAttempts=12 sun.rt._sync_Deflations=46 sun.rt._sync_EmptyNotifications=0 sun.rt._sync_FailedSpins=0 sun.rt._sync_FutileWakeups=2 sun.rt._sync_Inflations=50 sun.rt._sync_MonExtant=384 sun.rt._sync_MonInCirculation=0 sun.rt._sync_MonScavenged=0 sun.rt._sync_Notifications=25 sun.rt._sync_Parks=32 sun.rt._sync_PrivateA=0 sun.rt._sync_PrivateB=0 sun.rt._sync_SlowEnter=0 sun.rt._sync_SlowExit=0 sun.rt._sync_SlowNotify=0 sun.rt._sync_SlowNotifyAll=0 sun.rt._sync_SuccessfulSpins=0 sun.rt.applicationTime=12630762 sun.rt.createVmBeginTime=1505290045108 sun.rt.createVmEndTime=1505290045168 sun.rt.internalVersion="Java HotSpot(TM) 64-Bit Server VM (25.101-b13) for windows-amd64 JRE (1.8.0_101-b13), built on Jun 22 2016 01:21:29 by "java_re" with MS VC++ 10.0 (VS2010)" sun.rt.interruptedBeforeIO=0 sun.rt.interruptedDuringIO=0 sun.rt.javaCommand="boss-1.0.1.jar 2 127.0.0.1 80" sun.rt.jvmCapabilities="1100000000000000000000000000000000000000000000000000000000000000" sun.rt.jvmVersion=426049549 sun.rt.safepointSyncTime=238 sun.rt.safepointTime=761 sun.rt.safepoints=3 sun.rt.threadInterruptSignaled=0 sun.rt.vmInitDoneTime=1505290045155 sun.threads.vmOperationTime=184 sun.urlClassLoader.readClassBytesTime=6458313 sun.zip.zipFile.openTime=3587098 sun.zip.zipFiles=2
诊断命令
诊断命令的帮助信息
D:\>jcmd 9816 help 9816: The following commands are available: JFR.stop JFR.start JFR.dump JFR.check VM.native_memory VM.check_commercial_features VM.unlock_commercial_features ManagementAgent.stop ManagementAgent.start_local ManagementAgent.start GC.rotate_log Thread.print GC.class_stats GC.class_histogram GC.heap_dump GC.run_finalization GC.run VM.uptime VM.flags VM.system_properties VM.command_line VM.version help For more information about a specific command use 'help <command>'.
其中9816是某个jvm进程的pid。
具体诊断命令的帮助
如下是GC.run诊断命令的帮助信息。D:\>jcmd 9816 help GC.run 9816: GC.run Call java.lang.System.gc(). Impact: Medium: Depends on Java heap size and content. Syntax: GC.run
诊断命令的应用
GC.run诊断命令诊断前:
D:\>jstat -gcutil 9816 500 7 S0 S1 E O M CCS YGC YGCT FGC FGCT GCT 0.00 0.00 24.05 0.00 16.66 19.75 0 0.000 0 0.000 0.000 0.00 0.00 24.05 0.00 16.66 19.75 0 0.000 0 0.000 0.000 0.00 0.00 24.05 0.00 16.66 19.75 0 0.000 0 0.000 0.000 0.00 0.00 24.05 0.00 16.66 19.75 0 0.000 0 0.000 0.000 0.00 0.00 24.05 0.00 16.66 19.75 0 0.000 0 0.000 0.000 0.00 0.00 24.05 0.00 16.66 19.75 0 0.000 0 0.000 0.000 0.00 0.00 24.05 0.00 16.66 19.75 0 0.000 0 0.000 0.000
进行诊断操作:
D:\>jcmd 9816 GC.run 9816: Command executed successfully
诊断后:
D:\>jstat -gcutil 9816 500 7 S0 S1 E O M CCS YGC YGCT FGC FGCT GCT 0.00 0.00 0.00 1.21 79.67 87.24 1 0.001 1 0.004 0.006 0.00 0.00 0.00 1.21 79.67 87.24 1 0.001 1 0.004 0.006 0.00 0.00 0.00 1.21 79.67 87.24 1 0.001 1 0.004 0.006 0.00 0.00 0.00 1.21 79.67 87.24 1 0.001 1 0.004 0.006 0.00 0.00 0.00 1.21 79.67 87.24 1 0.001 1 0.004 0.006 0.00 0.00 0.00 1.21 79.67 87.24 1 0.001 1 0.004 0.006 0.00 0.00 0.00 1.21 79.67 87.24 1 0.001 1 0.004 0.006
在诊断前后,请注意FGC(Full GC)的变化。
VM.flags诊断命令
此命令只是显示JVM的参数信息。
D:\>jcmd 9816 VM.flags 9816: -XX:CICompilerCount=3 -XX:InitialHeapSize=134217728 -XX:MaxHeapSize=2120220672 -XX:MaxNewSize=706740224 -XX:MinHeapDelta Bytes=524288 -XX:NewSize=44564480 -XX:OldSize=89653248 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseFa stUnorderedTimeStamps -XX:-UseLargePagesIndividualAllocation -XX:+UseParallelGC
还有更多有用的诊断命令,请自己查验。
## jinfo-查看系统信息和JVM信息 ### 帮助信息 主要的参数是-flags打印JVM的信息和-sysprops打印系统的信息。
F:\soft\Java\jdk1.8\bin>jinfo
Usage:
jinfo [option]
(to connect to running process)
jinfo [option]
### 使用实例
F:\soft\Java\jdk1.8\bin>jinfo 5952
Attaching to process ID 5952, please wait…
Debugger attached successfully.
Server compiler detected.
JVM version is 25.101-b13
Java System Properties:
java.runtime.name = Java(TM) SE Runtime Environment
java.vm.version = 25.101-b13
sun.boot.library.path = F:\soft\Java\jre1.8\bin
java.vendor.url = http://java.oracle.com/
java.vm.vendor = Oracle Corporation
path.separator = ;
file.encoding.pkg = sun.io
java.vm.name = Java HotSpot(TM) 64-Bit Server VM
sun.os.patch.level = Service Pack 1
sun.java.launcher = SUN_STANDARD
user.script =
user.country = CN
user.dir = D:\web_work\boss\target
java.vm.specification.name = Java Virtual Machine Specification
java.runtime.version = 1.8.0_101-b13
java.awt.graphicsenv = sun.awt.Win32GraphicsEnvironment
os.arch = amd64
java.endorsed.dirs = F:\soft\Java\jre1.8\lib\endorsed
line.separator =
java.io.tmpdir = C:\Users\MICHAE~1\AppData\Local\Temp\
java.vm.specification.vendor = Oracle Corporation
user.variant =
os.name = Windows 7
sun.jnu.encoding = GBK
java.library.path = C:\ProgramData\Oracle\Java\javapath;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Progra
mData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell
\v1.0\;D:\soft\svn\bin;F:\soft\Java\jdk1.8\bin;E:\DTool\sdk\platform-tools;E:\DTool\sdk\tools;%MAVEN_HOME%\bin;D:\apache
-maven-3.3.9\bin;D:\soft\MySQL\MySQLServer\bin;D:\as\gradle\gradle-2.14.1\bin;H:\php56\;H:\php56\ext;H:\DownLoad\apache-
ant-1.10.1\bin;F:\Program Files\Git\cmd;F:\Program Files\Git\mingw64\bin;F:\Program Files\Git\usr\bin;F:\Program Files\V
isualSVN Server\bin;F:\soft\python3;F:\Program Files (x86)\AllWinnerTech\PhoenixSuit\;.
java.specification.name = Java Platform API Specification
java.class.version = 52.0
sun.management.compiler = HotSpot 64-Bit Tiered Compilers
os.version = 6.1
user.home = C:\Users\MichaelKoo
user.timezone =
java.awt.printerjob = sun.awt.windows.WPrinterJob
file.encoding = GBK
java.specification.version = 1.8
user.name = MichaelKoo
java.class.path = boss-1.0.1.jar
java.vm.specification.version = 1.8
sun.arch.data.model = 64
sun.java.command = boss-1.0.1.jar 2 124.42.243.67 8010
java.home = F:\soft\Java\jre1.8
user.language = zh
java.specification.vendor = Oracle Corporation
awt.toolkit = sun.awt.windows.WToolkit
java.vm.info = mixed mode
java.version = 1.8.0_101
java.ext.dirs = F:\soft\Java\jre1.8\lib\ext;C:\Windows\Sun\Java\lib\ext
sun.boot.class.path = F:\soft\Java\jre1.8\lib\resources.jar;F:\soft\Java\jre1.8\lib\rt.jar;F:\soft\Java\jre1.8\lib\sunrs
asign.jar;F:\soft\Java\jre1.8\lib\jsse.jar;F:\soft\Java\jre1.8\lib\jce.jar;F:\soft\Java\jre1.8\lib\charsets.jar;F:\soft\
Java\jre1.8\lib\jfr.jar;F:\soft\Java\jre1.8\classes
java.vendor = Oracle Corporation
sun.stderr.encoding = ms936
file.separator = \
java.vendor.url.bug = http://bugreport.sun.com/bugreport/
sun.io.unicode.encoding = UnicodeLittle
sun.cpu.endian = little
sun.stdout.encoding = ms936
sun.desktop = windows
sun.cpu.isalist = amd64
VM Flags:
Non-default VM flags: -XX:CICompilerCount=3 -XX:InitialHeapSize=134217728 -XX:MaxHeapSize=2120220672 -XX:MaxNewSize=7067
40224 -XX:MinHeapDeltaBytes=524288 -XX:NewSize=44564480 -XX:OldSize=89653248 -XX:+UseCompressedClassPointers -XX:+UseCom
pressedOops -XX:+UseFastUnorderedTimeStamps -XX:-UseLargePagesIndividualAllocation -XX:+UseParallelGC
Command line:
### 使用实例2-显示jvm参数
F:\soft\Java\jdk1.8\bin>jinfo -flags 5952
Attaching to process ID 5952, please wait…
Debugger attached successfully.
Server compiler detected.
JVM version is 25.101-b13
Non-default VM flags: -XX:CICompilerCount=3 -XX:InitialHeapSize=134217728 -XX:MaxHeapSize=2120220672 -XX:MaxNewSize=7067
40224 -XX:MinHeapDeltaBytes=524288 -XX:NewSize=44564480 -XX:OldSize=89653248 -XX:+UseCompressedClassPointers -XX:+UseCom
pressedOops -XX:+UseFastUnorderedTimeStamps -XX:-UseLargePagesIndividualAllocation -XX:+UseParallelGC
Command line:
## jmap-查看堆信息 ### 帮助信息 经常用到的参数有-heap显示堆信息和-clstats显示ClassLoader信息。
F:\soft\Java\jdk1.8\bin>jmap
Usage:
jmap [option]
(to connect to running process)
jmap [option]
### 使用实例 #### 查看堆信息
F:\soft\Java\jdk1.8\bin>jmap.exe -heap 5952
Attaching to process ID 5952, please wait…
Debugger attached successfully.
Server compiler detected.
JVM version is 25.101-b13
using thread-local object allocation.
Parallel GC with 4 thread(s)
Heap Configuration:
MinHeapFreeRatio = 0
MaxHeapFreeRatio = 100
MaxHeapSize = 2120220672 (2022.0MB)
NewSize = 44564480 (42.5MB)
MaxNewSize = 706740224 (674.0MB)
OldSize = 89653248 (85.5MB)
NewRatio = 2
SurvivorRatio = 8
MetaspaceSize = 21807104 (20.796875MB)
CompressedClassSpaceSize = 1073741824 (1024.0MB)
MaxMetaspaceSize = 17592186044415 MB
G1HeapRegionSize = 0 (0.0MB)
Heap Usage:
PS Young Generation
Eden Space:
capacity = 34078720 (32.5MB)
used = 7515688 (7.167518615722656MB)
free = 26563032 (25.332481384277344MB)
22.05390343299279% used
From Space:
capacity = 5242880 (5.0MB)
used = 0 (0.0MB)
free = 5242880 (5.0MB)
0.0% used
To Space:
capacity = 5242880 (5.0MB)
used = 0 (0.0MB)
free = 5242880 (5.0MB)
0.0% used
PS Old Generation
capacity = 89653248 (85.5MB)
used = 0 (0.0MB)
free = 89653248 (85.5MB)
0.0% used
2086 interned Strings occupying 186928 bytes.
#### 查看堆中的对象(以下是查看java.net包下的所有对象)
F:\soft\Java\jdk1.8\bin>jmap.exe -histo 5952 |findstr java.net.*
26: 26 1664 java.net.URL
83: 2 176 java.net.DualStackPlainSocketImpl
84: 2 176 java.net.PlainSocketImpl
90: 2 160 java.net.URI
106: 2 96 java.net.SocketInputStream
107: 2 96 java.net.SocketOutputStream
127: 3 72 java.net.ProxyType138:264java.net.InetAddressInetAddressHolder
139: 2 64 java.net.Socket
151: 2 48 java.net.Inet4Address
152: 2 48 java.net.InetAddressCache153:248java.net.InetAddressCacheType177:132[Ljava.net.ProxyType;
200: 1 24 [Ljava.net.InetAddressCacheType;
209: 1 24 java.net.Inet6AddressImpl
210: 1 24 java.net.Proxy
248: 1 16 java.net.InetAddress2249:116java.net.URLClassLoader7
### 查看所有classloader
F:\soft\Java\jdk1.8\bin>jmap -clstats 5952
Attaching to process ID 5952, please wait…
Debugger attached successfully.
Server compiler detected.
JVM version is 25.101-b13
finding class loader instances ..done.
computing per loader stat ..done.
please wait.. computing liveness…liveness analysis may be inaccurate …
class_loader classes bytes parent_loader alive? type
1547 2700258 null live
0x0000000081b010b0 1 1474 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081b016f0 1 880 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081b01d30 1 1474 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081b02370 1 880 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081b029b0 1 892 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081b03b30 2 4839 null dead javax/management/remote/rmi/NoCallStackClassLoader@0x000
0000016e037e0
0x0000000081b01178 1 1474 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081b017b8 1 880 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081b01df8 1 1474 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081b02438 1 1474 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081b02a78 1 892 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081b007a0 12 36867 0x0000000081a02f58 dead sun/reflect/misc/MethodUtil@0x0000000016e46e78
0x0000000081b00f20 1 1485 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081b01560 1 1474 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081b01ba0 1 880 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081b021e0 1 1474 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081b02820 1 1474 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081a02fb8 0 0 null live sun/misc/LauncherExtClassLoader@0x0000000016d3fa300x0000000081b00fe811474nulldeadsun/reflect/DelegatingClassLoader@0x0000000016d39df80x0000000081b0162811474nulldeadsun/reflect/DelegatingClassLoader@0x0000000016d39df80x0000000081b01c681880nulldeadsun/reflect/DelegatingClassLoader@0x0000000016d39df80x0000000081b022a81880nulldeadsun/reflect/DelegatingClassLoader@0x0000000016d39df80x0000000081b028e811474nulldeadsun/reflect/DelegatingClassLoader@0x0000000016d39df80x0000000081b92ba0000x0000000081a02f58deadjava/util/ResourceBundleRBClassLoader@0x0000000
016dac448
0x0000000081b013d0 1 880 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081b01a10 1 1474 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081b02050 1 880 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081b02690 1 1474 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081b02cd0 1 889 0x0000000081b007a0 dead sun/reflect/DelegatingClassLoader@0x0000000016d3
9df8
0x0000000081b01498 1 1474 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081b01ad8 1 1474 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081b02118 1 880 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081b02758 1 1474 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081b02d98 1 882 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081b01240 1 1474 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081b01880 1 880 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081b01ec0 1 880 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081b02500 1 1474 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081b02b40 1 892 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081a02f58 119 249212 0x0000000081a02fb8 live sun/misc/Launcher$AppClassLoader@0x0000000016d3f
688
0x0000000081b01308 1 1474 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081b01948 1 892 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081b01f88 1 880 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081b025c8 1 1474 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081b02c08 1 1475 null dead sun/reflect/DelegatingClassLoader@0x0000000016d39df8
0x0000000081b03c08 4 4012 null dead javax/management/remote/rmi/NoCallStackClassLoader@0x000
0000016e037e0
total = 47 1724 3043527 N/A alive=3, dead=44 N/A
## jstack-打印堆栈相关信息 此命令可以详细打印出来堆栈信息 ### 帮助信息 ```F:\soft\Java\jdk1.8\bin>jstack.exe Usage: jstack [-l] <pid> (to connect to running process) jstack -F [-m] [-l] <pid> (to connect to a hung process) jstack [-m] [-l] <executable> <core> (to connect to a core file) jstack [-m] [-l] [server_id@]<remote server IP or hostname> (to connect to a remote debug server) Options: -F to force a thread dump. Use when jstack <pid> does not respond (process is hung) -m to print both java and native frames (mixed mode) -l long listing. Prints additional information about locks -h or -help to print this help message <div class="se-preview-section-delimiter"></div>
使用实例
F:\soft\Java\jdk1.8\bin>jstack.exe 5952 2017-09-12 16:03:53 Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.101-b13 mixed mode): "RMI Scheduler(0)" #20 daemon prio=5 os_prio=0 tid=0x000000005a84a800 nid=0xd54 waiting on condition [0x000000005afcf000 ] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for <0x00000000d63564c0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionOb ject) at java.util.concurrent.locks.LockSupport.park(Unknown Source) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) "RMI TCP Accept-0" #18 daemon prio=5 os_prio=0 tid=0x0000000058e04000 nid=0x1304 runnable [0x0000000059e4e000] java.lang.Thread.State: RUNNABLE at java.net.DualStackPlainSocketImpl.accept0(Native Method) at java.net.DualStackPlainSocketImpl.socketAccept(Unknown Source) at java.net.AbstractPlainSocketImpl.accept(Unknown Source) at java.net.PlainSocketImpl.accept(Unknown Source) - locked <0x00000000d6358348> (a java.net.SocksSocketImpl) at java.net.ServerSocket.implAccept(Unknown Source) at java.net.ServerSocket.accept(Unknown Source) at sun.management.jmxremote.LocalRMIServerSocketFactory$1.accept(Unknown Source) at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(Unknown Source) at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(Unknown Source) at java.lang.Thread.run(Unknown Source) "Timer-1" #16 prio=5 os_prio=0 tid=0x0000000058cac000 nid=0x16bc in Object.wait() [0x000000005a11f000] java.lang.Thread.State: TIMED_WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on <0x0000000081a012b0> (a java.util.TaskQueue) at java.util.TimerThread.mainLoop(Unknown Source) - locked <0x0000000081a012b0> (a java.util.TaskQueue) at java.util.TimerThread.run(Unknown Source) "Timer-0" #15 prio=5 os_prio=0 tid=0x0000000058cab000 nid=0x4f0 in Object.wait() [0x0000000059fdf000] java.lang.Thread.State: TIMED_WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on <0x0000000081a01480> (a java.util.TaskQueue) at java.util.TimerThread.mainLoop(Unknown Source) - locked <0x0000000081a01480> (a java.util.TaskQueue) at java.util.TimerThread.run(Unknown Source) "WebsocketWriteThread" #14 prio=5 os_prio=0 tid=0x0000000058bb3800 nid=0x1020 waiting on condition [0x0000000059d1f000] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for <0x0000000081a01658> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionOb ject) at java.util.concurrent.locks.LockSupport.park(Unknown Source) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(Unknown Source) at java.util.concurrent.LinkedBlockingQueue.take(Unknown Source) at org.java_websocket.client.WebSocketClient$WebsocketWriteThread.run(WebSocketClient.java:413) at java.lang.Thread.run(Unknown Source) "WebsocketWriteThread" #13 prio=5 os_prio=0 tid=0x0000000058bb3000 nid=0x1324 waiting on condition [0x0000000059aee000] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for <0x0000000081a02578> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionOb ject) at java.util.concurrent.locks.LockSupport.park(Unknown Source) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(Unknown Source) at java.util.concurrent.LinkedBlockingQueue.take(Unknown Source) at org.java_websocket.client.WebSocketClient$WebsocketWriteThread.run(WebSocketClient.java:413) at java.lang.Thread.run(Unknown Source) "DestroyJavaVM" #12 prio=5 os_prio=0 tid=0x000000000259e000 nid=0x1040 waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE "Thread-1" #11 prio=5 os_prio=0 tid=0x0000000058ba2000 nid=0xcd8 runnable [0x0000000059bfe000] java.lang.Thread.State: RUNNABLE at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.socketRead(Unknown Source) at java.net.SocketInputStream.read(Unknown Source) at java.net.SocketInputStream.read(Unknown Source) at java.net.SocketInputStream.read(Unknown Source) at org.java_websocket.client.WebSocketClient.run(WebSocketClient.java:228) at java.lang.Thread.run(Unknown Source) "Thread-0" #10 prio=5 os_prio=0 tid=0x0000000058ba1800 nid=0x1614 runnable [0x00000000597de000] java.lang.Thread.State: RUNNABLE at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.socketRead(Unknown Source) at java.net.SocketInputStream.read(Unknown Source) at java.net.SocketInputStream.read(Unknown Source) at java.net.SocketInputStream.read(Unknown Source) at org.java_websocket.client.WebSocketClient.run(WebSocketClient.java:228) at java.lang.Thread.run(Unknown Source) "Service Thread" #9 daemon prio=9 os_prio=0 tid=0x0000000058afe800 nid=0x1158 runnable [0x0000000000000000] java.lang.Thread.State: RUNNABLE "C1 CompilerThread2" #8 daemon prio=9 os_prio=2 tid=0x0000000058a7b000 nid=0x1054 waiting on condition [0x00000000000000 00] java.lang.Thread.State: RUNNABLE "C2 CompilerThread1" #7 daemon prio=9 os_prio=2 tid=0x0000000058a79800 nid=0x16d8 waiting on condition [0x00000000000000 00] java.lang.Thread.State: RUNNABLE "C2 CompilerThread0" #6 daemon prio=9 os_prio=2 tid=0x000000005772f000 nid=0x1708 waiting on condition [0x00000000000000 00] java.lang.Thread.State: RUNNABLE "Attach Listener" #5 daemon prio=5 os_prio=2 tid=0x0000000057721000 nid=0x132c waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE "Signal Dispatcher" #4 daemon prio=9 os_prio=2 tid=0x0000000058a73000 nid=0xd7c runnable [0x0000000000000000] java.lang.Thread.State: RUNNABLE "Finalizer" #3 daemon prio=8 os_prio=1 tid=0x0000000057709000 nid=0x12f8 in Object.wait() [0x0000000058a5f000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on <0x0000000081a1d208> (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(Unknown Source) - locked <0x0000000081a1d208> (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(Unknown Source) at java.lang.ref.Finalizer$FinalizerThread.run(Unknown Source) "Reference Handler" #2 daemon prio=10 os_prio=2 tid=0x00000000576c2000 nid=0x1714 in Object.wait() [0x000000005879e000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on <0x0000000081a16218> (a java.lang.ref.Reference$Lock) at java.lang.Object.wait(Unknown Source) at java.lang.ref.Reference.tryHandlePending(Unknown Source) - locked <0x0000000081a16218> (a java.lang.ref.Reference$Lock) at java.lang.ref.Reference$ReferenceHandler.run(Unknown Source) "VM Thread" os_prio=2 tid=0x00000000576ba000 nid=0xb54 runnable "GC task thread#0 (ParallelGC)" os_prio=0 tid=0x000000000247c000 nid=0x1640 runnable "GC task thread#1 (ParallelGC)" os_prio=0 tid=0x000000000247d800 nid=0xa44 runnable "GC task thread#2 (ParallelGC)" os_prio=0 tid=0x000000000247f000 nid=0x680 runnable "GC task thread#3 (ParallelGC)" os_prio=0 tid=0x0000000002481000 nid=0x1630 runnable "VM Periodic Task Thread" os_prio=2 tid=0x0000000058b37800 nid=0x278 waiting on condition JNI global references: 359
相关文章推荐
- 经常用到的几个sed命令
- linux系统管理中经常用到的几个命令
- Linux下面经常用到的几个命令
- linux下的zip和unzip经常用到的几个命令
- linux经常要用到的几个命令
- Linux-经常用到的几个命令
- Linux下面经常用到的几个命令
- 几个经常用到的字符串的截取
- [原]分享几个日常开发中经常用到的软件
- 几个hive用到的命令
- php中经常用到的几个取整函数
- 几个经常用到的字符串的截取(java)
- .net中几个经常用到的字符串的截取
- C#几个经常用到的字符串截取
- 网络程序中经常用到的几个函数
- 编译android源码时用到的几个命令m、mm、mmm
- 经常用到的提取手机、电话、Email联系方式的几个java正则表达式
- spm 我经常用到的命令
- C#几个经常用到的字符串截取
- 几个经常用到的字符串的截取