`
iwindyforest
  • 浏览: 235718 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

JVM Learning Note 3 -- JVM Performance Monitor Tools

阅读更多

JDK Provided Tools

 

Command Line Tools

  • jps
  • jstat
  • jinfo
  • jmap


Visual Tools

  • JConsole
  • VisualVM with Plugins

 


jps - JVM Process Status
USAGE
jps -lvm


OPTIONS
The jps command supports a number of options that modify the output of the command. These options are subject to change or removal in the future.
-q
Suppress the output of the class name, JAR file name, and arguments passed to the main method, producing only a list of local VM identifiers.


-m
Output the arguments passed to the main method. The output may be null for embedded JVMs.


-l
Output the full package name for the application's main class or the full path name to the application's JAR file.


-v
Output the arguments passed to the JVM.


-V
Output the arguments passed to the JVM through the flags file (the .hotspotrc file or the file specified by the -XX:Flags=<filename> argument).


-Joption
Pass option to the java launcher called by jps. For example, -J-Xms48m sets the startup memory to 48 megabytes. It is a common convention for -J to pass options to the underlying VM executing applications written in Java.


HOST IDENTIFIER
The host identifier, or hostid is a string that indicates the target system. The syntax of the hostid string largely corresponds to the syntax of a URI:
[protocol:][[//]hostname][:port][/servername]

protocol
The communications protocol. If the protocol is omitted and a hostname is not specified, the default protocol is a platform specific, optimized, local protocol. If the protocol is omitted and a hostname is specified, then the default protocol is rmi.


hostname
A hostname or IP address indicating the target host. If hostname is omitted, then the target host is the local host.


port
The default port for communicating with the remote server. If the hostname is omitted or the protocol specifies an optimized, local protocol, then port is ignored. Otherwise, treatment of the port parameter is implementation specific. For the default rmi protocol the port indicates the port number for the rmiregistry on the remote host. If port is omitted, and protocol indicates rmi, then the default rmiregistry port (1099) is used.


servername
The treatment of this parameter depends on the implementation. For the optimized, local protocol, this field is ignored. For the rmi protocol, this parameter is a string representing the name of the RMI remote object on the remote host. See the -n option for the jstatd command.


OUTPUT FORMAT
The output of the jps command follows the following pattern:
lvmid [ [ classname | JARfilename | "Unknown"] [ arg* ] [ jvmarg* ] ]
Where all output tokens are separated by white space. An arg that includes embedded white space will introduce ambiguity when attempting to map arguments to their actual positional parameters.

 

 

 

 

 


jstat - Statistics Monitoring Tool


EXAMPLES
jstat -gcutil 21891 250 7
This example attaches to lvmid 21891 and takes 7 samples at 250 millisecond intervals and displays the output as specified by the -gcutil option.

jstat -gcnew -h3 21891 250
This example attaches to lvmid 21891 and takes samples at 250 millisecond intervals and displays the output as specified by -gcutil option. In addition, it uses the -h3 option to output the column header after every 3 lines of data.

 


OPTIONS
-statOption
Determines the statistics information that jstat displays. The following table lists the available options. Use the -options general option to display the list of options for a particular platform installation.
Option    Displays...


class    Statistics on the behavior of the class loader.


compiler    Statistics of the behavior of the HotSpot Just-in-Time compiler.


gc    Statistics of the behavior of the garbage collected heap.


gccapacity    Statistics of the capacities of the generations and their corresponding spaces.


gccause    Summary of garbage collection statistics (same as -gcutil), with the cause of the last and current (if applicable) garbage collection events.


gcnew    Statistics of the behavior of the new generation.


gcnewcapacity    Statistics of the sizes of the new generations and its corresponding spaces.


gcold    Statistics of the behavior of the old and permanent generations.


gcoldcapacity    Statistics of the sizes of the old generation.


gcpermcapacity    Statistics of the sizes of the permanent generation.


gcutil    Summary of garbage collection statistics.


printcompilation    HotSpot compilation method statistics.


-h n
Display a column header every n samples (output rows), where n is a positive integer. Default value is 0, which displays the column header above the first row of data.


-t
Display a timestamp column as the first column of output. The timestamp is the time since the start time of the target JVM.


-JjavaOption
Pass javaOption to the java application launcher. For example, -J-Xms48m sets the startup memory to 48 megabytes.

 


STATOPTIONS AND OUTPUT
The following tables summarize the columns that jstat outputs for each statOption.


-class Option
Column    Description
Loaded    Number of classes loaded.
Bytes    Number of Kbytes loaded.
Unloaded    Number of classes unloaded.
Bytes    Number of Kbytes unloaded.
Time    Time spent performing class load and unload operations.
-compiler Option
HotSpot Just-In-Time Compiler Statistics
Column    Description
Compiled    Number of compilation tasks performed.
Failed    Number of compilation tasks that failed.
Invalid    Number of compilation tasks that were invalidated.
Time    Time spent performing compilation tasks.
FailedType    Compile type of the last failed compilation.
FailedMethod    Class name and method for the last failed compilation.


-gc Option
Column    Description
S0C    Current survivor space 0 capacity (KB).
S1C    Current survivor space 1 capacity (KB).
S0U    Survivor space 0 utilization (KB).
S1U    Survivor space 1 utilization (KB).
EC    Current eden space capacity (KB).
EU    Eden space utilization (KB).
OC    Current old space capacity (KB).
OU    Old space utilization (KB).
PC    Current permanent space capacity (KB).
PU    Permanent space utilization (KB).
YGC    Number of young generation GC Events.
YGCT    Young generation garbage collection time.
FGC    Number of full GC events.
FGCT    Full garbage collection time.
GCT    Total garbage collection time.


-gccapacity Option
Column    Description
NGCMN    Minimum new generation capacity (KB).
NGCMX    Maximum new generation capacity (KB).
NGC    Current new generation capacity (KB).
S0C    Current survivor space 0 capacity (KB).
S1C    Current survivor space 1 capacity (KB).
EC    Current eden space capacity (KB).
OGCMN    Minimum old generation capacity (KB).
OGCMX    Maximum old generation capacity (KB).
OGC    Current old generation capacity (KB).
OC    Current old space capacity (KB).
PGCMN    Minimum permanent generation capacity (KB).
PGCMX    Maximum Permanent generation capacity (KB).
PGC    Current Permanent generation capacity (KB).
PC    Current Permanent space capacity (KB).
YGC    Number of Young generation GC Events.
FGC    Number of Full GC Events.


-gccause Option
This option displays the same summary of garbage collection statistics as the -gcutil option, but includes the causes of the last garbage collection event and (if applicable) the current garbage collection event. In addition to the columns listed for -gcutil, this option adds the following columns:


Column    Description
LGCC    Cause of last Garbage Collection.
GCC    Cause of current Garbage Collection.


-gcnew Option
Column    Description
S0C    Current survivor space 0 capacity (KB).
S1C    Current survivor space 1 capacity (KB).
S0U    Survivor space 0 utilization (KB).
S1U    Survivor space 1 utilization (KB).
TT    Tenuring threshold.
MTT    Maximum tenuring threshold.
DSS    Desired survivor size (KB).
EC    Current eden space capacity (KB).
EU    Eden space utilization (KB).
YGC    Number of young generation GC events.
YGCT    Young generation garbage collection time.


-gcnewcapacity Option
Column    Description
NGCMN     Minimum new generation capacity (KB).
NGCMX     Maximum new generation capacity (KB).
NGC     Current new generation capacity (KB).
S0CMX    Maximum survivor space 0 capacity (KB).
S0C    Current survivor space 0 capacity (KB).
S1CMX    Maximum survivor space 1 capacity (KB).
S1C    Current survivor space 1 capacity (KB).
ECMX    Maximum eden space capacity (KB).
EC    Current eden space capacity (KB).
YGC    Number of young generation GC events.
FGC    Number of Full GC Events.


-gcold Option
Column    Description
PC    Current permanent space capacity (KB).
PU    Permanent space utilization (KB).
OC    Current old space capacity (KB).
OU    old space utilization (KB).
YGC    Number of young generation GC events.
FGC    Number of full GC events.
FGCT    Full garbage collection time.
GCT    Total garbage collection time.


-gcoldcapacity Option
Column    Description
OGCMN    Minimum old generation capacity (KB).
OGCMX    Maximum old generation capacity (KB).
OGC    Current old generation capacity (KB).
OC    Current old space capacity (KB).
YGC    Number of young generation GC events.
FGC    Number of full GC events.
FGCT    Full garbage collection time.
GCT    Total garbage collection time.


-gcpermcapacity Option
Column    Description
PGCMN    Minimum permanent generation capacity (KB).
PGCMX    Maximum permanent generation capacity (KB).
PGC    Current permanent generation capacity (KB).
PC    Current permanent space capacity (KB).
YGC    Number of young generation GC events.
FGC    Number of full GC events.
FGCT    Full garbage collection time.
GCT    Total garbage collection time.


-gcutil Option
Column    Description
S0    Survivor space 0 utilization as a percentage of the space's current capacity.
S1    Survivor space 1 utilization as a percentage of the space's current capacity.
E    Eden space utilization as a percentage of the space's current capacity.
O    Old space utilization as a percentage of the space's current capacity.
P    Permanent space utilization as a percentage of the space's current capacity.
YGC    Number of young generation GC events.
YGCT    Young generation garbage collection time.
FGC    Number of full GC events.
FGCT    Full garbage collection time.
GCT    Total garbage collection time.


-printcompilation Option
Column    Description
Compiled    Number of compilation tasks performed by the most recently compiled method.
Size    Number of bytes of bytecode of the most recently compiled method.
Type    Compilation type of the most recently compiled method.
Method    Class name and method name identifying the most recently compiled method. Class name uses "/" instead of "." as namespace separator. Method name is the method within the given class. The format for these two fields is consistent with the HotSpot - XX:+PrintComplation option.

 


jinfo - Configuration Info
USAGE
jinfo [ option ] pid
jinfo [ option ] executable core
jinfo [ option ] [server-id@]remote-hostname-or-IP


OPTIONS
<no option>
prints both command line flags as well as System properties name, value pairs.


-flag name
prints the name and value of the given command line flag.


-flag [+|-]name
enables or disables the given boolean command line flag.


-flag name=value
sets the given command line flag to the specified value.


-flags
prints command line flags passed to the JVM. pairs.


-sysprops
prints Java System properties as name, value pairs.


-h
prints a help message


-help
prints a help message

 

 

 

jmap - Memory Map
USAGE
jmap [ option ] pid
jmap [ option ] executable core
jmap [ option ] [server-id@]remote-hostname-or-IP

OPTIONS
<no option>
When no option is used jmap prints shared object mappings. For each shared object loaded in the target VM, start address, the size of the mapping, and the full path of the shared object file are printed. This is similar to the Solaris pmap utility.

-dump:[live,]format=b,file=<filename>
Dumps the Java heap in hprof binary format to filename. The live suboption is optional. If specified, only the live objects in the heap are dumped. To browse the heap dump, you can use jhat (Java Heap Analysis Tool) to read the generated file.

-finalizerinfo
Prints information on objects awaiting finalization.

-heap
Prints a heap summary. GC algorithm used, heap configuration and generation wise heap usage are printed.

-histo[:live]
Prints a histogram of the heap. For each Java class, number of objects, memory size in bytes, and fully qualified class names are printed. VM internal class names are printed with '*' prefix. If the live suboption is specified, only live objects are counted.

-permstat
Prints class loader wise statistics of permanent generation of Java heap. For each class loader, its name, liveness, address, parent class loader, and the number and size of classes it has loaded are printed. In addition, the number and size of interned Strings are printed.

-F
Force. Use with jmap -dump or jmap -histo option if the pid does not respond. The live suboption is not supported in this mode.

-h
Prints a help message.

-help
Prints a help message.

-J<flag>
Passes <flag> to the Java virtual machine on which jmap is run.

 

分享到:
评论

相关推荐

    jvm调优测试仓库-jvm-monitor.zip

    JVM调优是优化Java应用程序性能的关键环节,而"jvm-monitor"则提供了一种工具集来帮助开发者监控和分析JVM的状态。本文将深入探讨JVM调优的概念、方法以及如何利用"jvm-monitor"进行有效的监控。 一、JVM调优基础 ...

    nginx-upstream-jvm-route-1.15

    【标题】"nginx-upstream-jvm-route-1.15" 涉及的核心知识点是Nginx的upstream模块与JVM路由的整合,特别针对Nginx 1.15版本。这个项目旨在解决在配置Nginx时遇到的特定错误提示“nginx: [emerg] invalid parameter ...

    jvm性能调优-jvm内存模型和优化-performance-jvm-memorymodel-optimize.zip

    《JVM性能调优:深入理解JVM内存模型与优化》 在Java开发中,JVM(Java Virtual Machine)性能调优是提升应用程序效率的关键环节。JVM内存模型的理解和优化,对于解决性能瓶颈、避免内存泄漏以及提高系统稳定性至关...

    JVM调优总结 Xms -Xmx -Xmn -Xss

    ### JVM调优总结:Xms、Xmx、Xmn、Xss 在Java虚拟机(JVM)的运行过程中,合理的参数配置对于提高程序性能至关重要。本文将对JVM调优中的几个关键参数进行深入解析,包括-Xms、-Xmx、-Xmn和-Xss等,帮助开发者更好...

    JVM调优总结 -Xms -Xmx -Xmn -Xss

    JVM调优总结 -Xms -Xmx -Xmn -Xss JVM 调优是 Java virtual machine 的性能优化,通过调整 JVM 的参数来提高 Java 应用程序的性能。其中,-Xms、-Xmx、-Xmn、-Xss 是四个重要的参数,分别控制 JVM 的初始堆大小、...

    metrics-jvm-3.1.5-API文档-中文版.zip

    赠送jar包:metrics-jvm-3.1.5.jar; 赠送原API文档:metrics-jvm-3.1.5-javadoc.jar; 赠送源代码:metrics-jvm-3.1.5-sources.jar; 赠送Maven依赖信息文件:metrics-jvm-3.1.5.pom; 包含翻译后的API文档:...

    Android代码-Kotlin-Reflect-Tools-For-JVM

    Note: This tools only availible for JVM not fit for android platform ,If you use on Android platform, Please use Kotlin-Reflect-Tools-For-Android Usage Add jcenter repository in your moduel build ...

    java jvm 参数 -Xms -Xmx -Xmn -Xss -

    Java虚拟机(JVM)是Java程序运行的基础,它负责解释和执行字节码。在JVM中,内存管理是至关重要的,而`-Xms`, `-Xmx`, `-Xmn`, `-Xss`等参数则直接影响着Java应用程序的性能和稳定性。这些参数是用来调整JVM堆内存...

    基于jvm-sandbox-repeater重新开发的一款流量回放平台产品

    Moonbox(月光宝盒)是JVM-Sandbox生态下的,基于jvm-sandbox-repeater重新开发的一款流量回放平台产品。在jvm-sandbox-repeater基础上提供了更加丰富功能,同时便于线上部署和使用,更多对比参考。 使用场景 你...

    性能调优专题-jvm类加载机制-performance-jvmclassloader.zip

    本专题"性能调优专题-jvm类加载机制-performance-jvmclassloader"深入探讨了如何通过理解并优化类加载过程来提升应用程序的性能。 1. **类加载器的层次结构** Java中的类加载器分为Bootstrap ClassLoader、...

    Android Studio 报错failed to create jvm error code -4的解决方法

    代码如下:failed to create jvm error code -4 这一般应是内存不够用所致,解决方法参考如下。 打开 Android Studio 安装目录下的bin目录,查找并打开文件 studio.exe.vmoptions,修改代码: 代码如下:-Xmx512m 为...

    JVM-Tunning-Tools-Introduction

    3. jinfo:这个工具可以查看和修改JVM启动参数。jinfo可以连接到正在运行的Java进程或核心文件,并显示虚拟机配置的命令行标志。 4. jstat:用于收集Java虚拟机的统计信息。这个工具可以用来检测垃圾收集和堆内存...

    第3节: 揭秘JVM运行时数据区-02

    第3节: 揭秘JVM运行时数据区-02第3节: 揭秘JVM运行时数据区-02第3节: 揭秘JVM运行时数据区-02第3节: 揭秘JVM运行时数据区-02第3节: 揭秘JVM运行时数据区-02第3节: 揭秘JVM运行时数据区-02第3节: 揭秘JVM运行...

    java性能调优-jvm创建对象和-performance-createobj-allocationmemory.zip

    3. **初始化对象**:分配好内存后,JVM会执行构造函数对对象进行初始化,赋予实例变量初始值。 4. **对象引用**:最后,JVM返回对象的引用,供程序使用。 二、内存分配策略 1. **栈内存**:基本类型的局部变量和...

    metrics-jvm-3.1.5-API文档-中英对照版.zip

    赠送jar包:metrics-jvm-3.1.5.jar; 赠送原API文档:metrics-jvm-3.1.5-javadoc.jar; 赠送源代码:metrics-jvm-3.1.5-sources.jar; 赠送Maven依赖信息文件:metrics-jvm-3.1.5.pom; 包含翻译后的API文档:...

    jvm知识点整理-脑图

    jvm知识点整理-脑图

    框架->java语言->jvm->os->汇编->硬件

    标题 "框架-&gt;java语言-&gt;jvm-&gt;os-&gt;汇编-&gt;硬件" 描述了一条技术学习路径,从上至下深入理解软件开发的核心技术栈。这个路径涵盖了从应用框架到底层硬件的关键环节,让我们逐步解析其中涉及的知识点: 1. **框架**:...

    Jvm优化的Java -Demo

    在Java开发中,Java虚拟机(JVM)是运行Java应用程序的关键组件,它负责解析字节码、管理内存以及执行程序。"Jvm优化的Java - Demo"是一个项目,旨在演示如何调整JVM参数来优化Java应用程序的性能。通过这个项目,...

    jvm全面知识详解-全网最全(JVM面试题)

    jvm全面知识详解-全网最全(JVM面试题)

Global site tag (gtag.js) - Google Analytics