1、jps 虚拟机进程状况工具
语法 jsp [option] [hostid]
选项 | 作用 |
-q | 只显示lvmid |
-m | 输出虚拟机启用时传入main方法参数 |
-l | 输出主类全名 |
-v | 输出jvm参数 |
注意:
如果在linux环境中jps命令不能输出vmid数据(jdk1.6.0.23/24 bug),需要修改catalina.sh文件
if [ -z "$CATALINA_TMPDIR" ] ; then
# Define the java.io.tmpdir to use for Catalina
# CATALINA_TMPDIR="$CATALINA_BASE"/temp
CATALINA_TMPDIR=/tmp
fi
修改CATALINA_TMPDIR路径
2、jstat 虚拟机统计信息监控工具
语法:
jstat [option vmid [interval[s|ms]] [count]]
option选项
class | 统计class loader行为信息 |
compiler | 统计编译行为信息 |
gc | 统计jdk gc时heap信息 |
gccapacity | 统计堆内存不同代的heap容量信息 |
gccause | 统计gc的情况(同-gcutil)和引起gc的事件 |
gcnew | 统计gc时新生代的信息(相比gcutil更详细) |
gcnewcapacity | 统计gc时新生代heap容量 |
gcold | 统计gc时,老年区的情况 |
gcoldcapacity | 统计gc时,老年区heap容量 |
gcpermcapacity | 统计gc时,permanent区heap容量 |
gcutil | 统计gc时,heap情况 |
printcompilation | 统计编译行为信息 |
例如:
jstat -gc 1111 250 2
查看vmid为1111的虚拟机每个250毫秒执行一次,共执行两次
结果分析
-class option:Class Loader Statistics
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:HotSpot Just-In-Time Compiler Statistics
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:Garbage-collected heap statistics
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:Memory Pool Generation and Space Capacities
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:Garbage Collection Statistics, Including GC Events
LGCC | Cause of last Garbage Collection. |
GCC | Cause of current Garbage Collection. |
前面的字段与gcutil相同.
-gcnew Option:New Generation Statistics
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:New Generation Space Size Statistics
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:Old and Permanent Generation Statistics
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:Old Generation Statistics
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: Permanent Generation Statistics
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:Summary of Garbage Collection Statistics
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: HotSpot Compiler Method Statistics
Compiled | Number of compilation tasks performed. |
Size | Number of bytes of bytecode for the method. |
Type | Compilation type. |
Method | Class name and method name identifying the 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. |
相关推荐
第二节:JVM内存模型 1.1 概念 1.2 JVM内存模型 1.3 Heap堆内存模型 第三节:定位垃圾对象的依据 1.1 引用计数法 1.2 可达性算法 第四节:垃圾回收算法 1.1标记清除算法 1.2复制算法 1.3 标记整理(标记压缩)...
/ 76 4.1 概述 / 76 4.2 JDK的命令行工具 / 76 4.2.1 jps:虚拟机进程状况工具 / 79 4.2.2 jstat:虚拟机统计信息监视工具 / 80 4.2.3 jinfo:Java配置信息工具 / 82 4.2.4 jmap:Java内存映像工具 / 82 4.2.5...
gc即垃圾收集机制是指jvm用于释放那些不再使用的对象所占用的内存。java语言并不要求jvm有gc,也没有规定gc如何工作。不过常用的jvm都有gc,而且大多数gc都使用类似的算法管理内存和执行收集操作。 在充分理解了...
JVM全称是Java Virtual Machine,Java虚拟机,也就是在计算机上再虚拟一个计算机,这和我们使用 VMWare不一样,那个虚拟的东西你是可以看到的,这个JVM你是看不到的,它存在内存中。我们知道计算机的基本构成是:...
JVM内存分析工具比较多,这里介绍最常用的两个工具:jmap、arthas。 2.基于jmap进行FE堆内存分析jmap用于查看堆内对象的统计信息,也可用于生成Java进程的dump文件,dump文件保存了可以输出的所有内存对象。 2.1通过jmap...
指定jvm heap在使用率小于n的情况下,heap进行收缩,Xmx==Xms的情况下无效,如:-XX:MinHeapFreeRatio=30 j: -XX:MaxHeapFreeRatio= 指定jvm heap在使用率大于n的情况下,heap 进行扩张,Xmx==Xms的情况下无效,如:...
这500M内存中的一部分必须用于系统dll的加载,那么真正剩下的也许只有400M,现在关键的地方出现了:当你使用Java创建一个线程,在JVM的内存里也会创建一个Thread对象,但是同时也会在操作系统里创建一个真正的物理...
Java VisualVM是一个多线程的监控分析工具,VisualVM 是一款免费的\集成了多个 JDK 命令行工具的可视化工具,它能为您提供强大的分析能力,...它集成了多个JDK命令工具的一个可视化工具,它主要用来监控JVM的运行情况,
*.java命令进行编译(其中-classpath用来告诉编译器用户Java文件的路径,“ . ”表示*.java文件的路径在当前目录位置,注意点的前后均有一个空格)。经过编译产生*.class文件后,在C:\temp>提示符下使用java –...
当我们用java命令运行某个类的main函数启动程序时,首先需要通过类加载器把主类加载到JVM。 public class Math { public static final int initData = 666; public static User user = new User(); public int ...
第五部分探讨了Java实现高效并发的原理,包括JVM内存模型的结构和操作;原子性、可见性和有序性在Java内存模型中的体现;先行发生原则的规则和使用;线程在Java语言中的实现原理;虚拟机实现高效并发所做的一系列锁...
内存处理是编程人员容易出现问题的地方,忘记或者错误的内存回收会导致程序或系统的不稳定甚至崩溃,Java提供的GC功能可以自动监测对象是否超过作用域从而达到自动回收内存的目的,Java语言没有提供释放已分配内存的...
13. 同步和异步有何异同,在什么情况下分别使用他们?举例说明。 11 14. 简述synchronized和java.util.concurrent.locks.Lock的异同 ? 11 15. 当一个线程进入一个对象的一个synchronized方法后,其它线程是否可进入...
1、在 java 的 bin 目录下,jdk 提供了很多使用的工具,下面学习一些监控和故障处理的工具。 名称 作用 jps JVM process status tool,显示指定系统内所有的 HotSpot 虚拟机进程 jstat JVM statistics ...
java进程占用CPU过高常见的两种情况: 代码中有死循环或者接近死循环的操作 快速创建大量临时变量,导致频繁触发gc回收 问题解决: 1、用top命令找到cpu占用率最高的进程号是8958 top 2、top -Hp pid 命令找到该...
通过直接在源代码中声明依赖项来允许Java文件在不使用构建系统的情况下使用任何依赖项(Apache Ivy在内部用于下载deps)。 提供一个可以避免JVM启动和预热缓慢的守护进程。 这就是为什么Rust用于jgrab-client的原因...
内存处理是编程人员容易出现问题的地方,忘记或者错误的内存回收会导致程序或系统的不稳定甚至崩溃,Java提供的GC功能可以自动监测对象是否超过作用域从而达到自动回收内存的目的,Java语言没有提供释放已分配内存的...
的 Android SDK 提供了在 Android 平台上使用 JaVa 语言进行 Android 应用开发必须的工具和 API 接口。 特性 • 应用程序框架 支持组件的重用与替换 • Dalvik Dalvik Dalvik Dalvik 虚拟机 专为移动设备优化 • ...
设计模式之 Template(模板方法) 实际上向你介绍了为什么要使用 Java 抽象类,该模式原理简单,使用很普遍. 设计模式之 Strategy(策略) 不同算法各自封装,用户端可随意挑选需要的算法. 设计模式之 Chain of ...