【JVM】JVM性能监控与故障处理工具

来源:互联网 发布:橱柜设计师软件 编辑:程序博客网 时间:2024/05/22 13:03

一、概述
给一个系统定位问题的时候,知识、经验是关键基础,数据是依据,工具是运用知识处理数据的手段。这里说的数据包括:运行日志、异常堆栈、GC日志、线程快照(threadDump/javacore文件)、堆转储快照(heapDump/hprof文件)等。介绍JVM性能监控与故障处理工具旨在帮助大家了解如何使用sun公司给我们Java开发者提供的JVM监控工具。

名称 主要作用 jps JVM Process Status Tool,显示指定系统内所有的HotSpot虚拟机进行 jstat JVM Statistics Monitoring Tool,用于手机HotSpot虚拟机各方面的运行数据 jinfo Configuration Info for Java,显示虚拟机配置信息
C:\Users\moxianbin>jps -v6932 Launcher -Xmx700m -Djava.awt.headless=true -Djava.endorsed.dirs="" -Djdt.compiler.useSingleThread=true -Dpreload.project.path=C:/Users/moxianbin/git/gateway-test -Dpreload.config.path=C:/Users/moxianbin/.IntelliJIdea2016.2/config/options -Dcompile.parallel=false -Drebuild.on.dependency.change=true -Djava.net.preferIPv4Stack=true -Dio.netty.initialSeedUniquifier=-5953357909903199040 -Dfile.encoding=GBK -Djps.file.types.component.name=FileTypeManager -Duser.language=zh -Duser.country=CN -Didea.paths.selector=IntelliJIdea2016.2 -Didea.home.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 2016.2.1 -Didea.config.path=C:\Users\moxianbin\.IntelliJIdea2016.2\config -Didea.plugins.path=C:\Users\moxianbin\.IntelliJIdea2016.2\config\plugins -Djps.log.dir=C:/Users/moxianbin/.IntelliJIdea2016.2/system/log/build-log -Djps.fallback.jdk.home=C:/Program Files (x86)/JetBrains/IntelliJ IDEA 2016.2.1/jre/jre -Djps.fallback.jdk.version=1.8.0_76-release -Djava.io.tmpdir=C:/Users/moxianbin/.IntelliJIdea2016.2/system/compile-server/_temp_45512 Launcher -Xmx700m -Djava.awt.headless=true -Djava.endorsed.dirs="" -Djdt.compiler.useSingleThread=true -Dpreload.project.path=C:/Users/moxianbin/git/GuavaStudy -Dpreload.config.path=C:/Users/moxianbin/.IntelliJIdea2016.2/config/options -Dcompile.parallel=false -Drebuild.on.dependency.change=true -Djava.net.preferIPv4Stack=true -Dio.netty.initialSeedUniquifier=-5953357909903199040 -Dfile.encoding=GBK -Didea.maven.embedder.version=3.3.9 -Dfile.encoding=GBK
C:\Users\moxianbin>jinfo -flags 6932Attaching to process ID 6932, please wait...Debugger attached successfully.Server compiler detected.JVM version is 25.66-b18Non-default VM flags: -XX:CICompilerCount=3 -XX:InitialHeapSize=134217728 -XX:MaxHeapSize=734003200 -XX:MaxNewSize=244318208 -XX:MinHeapDeltaBytes=524288 -XX:NewSize=44564480 -XX:OldSize=89653248 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseFastUnorderedTimeStamps -XX:-UseLargePagesIndividualAllocation -XX:+UseParallelGC

名称 主要作用 jmap Memory Map For Java,生成虚拟机的内存转储快照OOM异常必备指令(heapdump文件),也可以使用JVM OPTION进行打印 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/Users/moxianbin/Documents/Java/heapdump.hprod jhat JVM Heap Dump Browser,用于分析heapdump文件,它会建议一个HTTP/HTML服务器,让用户可以在浏览器上查看分析结果 jstack Stack Trace For Java,显示虚拟机的线程栈快照
原创粉丝点击