jvm性能查看工具

jps查看所有java进程。

jconsole

jvisualVM

jmap pid 查看共享对象。
jmap -heap pid 查看java进程堆的相关信息。
jmap -histo pid 查询各种对象占用的内存大小。
jmap -permstat pid 查看Class Loader。
jmap -dump:file=filename,format=b pid dump内存到文件。


jstat -gc pid 间隔时间(ms) 观测各代空间的使用量和GC的统计。
jstat -gccapacity pid 查看内存空间大小。
jstat -gcutil pid 间隔时间(ms) 查看gc次数和内存占用百分比。
jstat -gcnew  pid 间隔时间(ms) 查看内存使用和young GC次数耗时。

jstack导出线程。
TDA分析线程dump。多个thread dump比对检查。


Mat使用简要笔记

1 heap dump
heap dump一般有如下信息:object,classes,gc roots,thread stacks,local variables.
A heap dump does not contain allocation information so it cannot resolve questions like who had created the objects

and where they have been created.

2 Retained set
Retained set of X is the set of objects which would be removed by GC when X is garbage collected.
Retained heap of X is the sum of shallow sizes of all objects in the retained set of X, i.e. memory kept alive by X.

3 Dominator Tree
An object x dominates an object y if every path in the object graph from the start (or the root) node to y must go

through x.

4 gc root

5 The Leak Report

6 Thread

7 Analyzing Finalizer

你可能感兴趣的:(java)