JVM tools and Linux-top command parsing

top command

top command to view information on the case now occupied by a thread.

1297993-20191229164958154-320467418.png

Third row, cpu status information specific attributes as follows: us - the percentage of space occupied by the user's CPU. (Important) sy - the percentage of space occupied by the CPU core. The percentage of soft interrupt (Software Interrupts) CPU-intensive - ni - changed the process priority of CPU-percentage id - idle CPU percentage wa - IO wait CPU-percentage hi - hardware interrupt (Hardware IRQ) CPU-percentage si

The following represents the various threads footprint of the situation,

PID process the above mentioned id 
the USER process owner 
Priority PR process 
NI nice value. A negative value indicates high priority, low priority positive value indicates 
the total amount of virtual memory used by the process VIRT, unit kb. The SWAP the RES + = VIRT 
the RES used in the process, are not swapped out of physical memory size in kb. The DATA CODE + = the RES 
the SHR shared memory size in kB 
S process state. D = uninterruptible sleep state R = running S = sleep T = trace / stop Z = zombie process 
% CPU last update to the current CPU time occupancy percentage 
percentage of physical memory% MEM process used (important) 
the TIME + CPU used by the process Total time the unit 1/100 sec 
cOMMAND process name (command name / command line)

For example, I want to see all the related threads occupancy java

top -H -p 24334 

1297993-20191229175416147-1571300269.png

Jstack command to print using the tool stack

jstack is JDK built-in stack trace tool

 jstack 24334 > jstack.txt 

(6902 is the PID Java process) prints out a stack information Java process into jstack.txt files; native id due to the stack of print mechanism thread sixteen, so I put the decimal converted into sixteen threads 24340 ary 5f14

Finally,

 cat jstack.txt  | grep -C 20 5f14 

jstat hate memory usage

jstat JVM is JDK built-in statistical tools to detect, in real time statistics on usage ** ** heap memory.

1297993-20191229181452973-622647364.png

JVM meaning and above one-parameter values

E: Eden area 
O: Old region 
FGC: Full frequency and the GC, the CCP Examples 4 
FGCT: Full GC time, an example of a total of about 0.2 seconds

This tool is very useful to check a memory leak. Here reference to a memory leak example in Resources:

1297993-20191229182924379-285411205.png

E(Eden区)跟O(Old区)的内存已经被耗尽了,FGC(Full GC)的次数高达6989次,FGCT(Full GC Time)的时间高达36453秒,即平均每次FGC的时间为:36453/6989 ≈ 5.21秒。也就是说,Java进程都把时间花在GC上了,所以就没有时间来处理其他事情。

jmap memory map information acquisition process

If this really a memory leak, you must know the corresponding code where we can solve the problem, then use the tool to detect jmap a thread in a memory-mapped objects is what.

jmap -histo 24334|less

Which |lessrepresents the number of pages printed reveal it slowly instead of all at once to brush the bottom.

The number of bytes and the number of instances of such analyzes can be performed.

jmap -histo 24334|less|grep sun

Where |grep sunit is a screening, this command behind the increase in other commands, too, can be used.

Reference material

https://blog.csdn.net/liubin1991liubin/article/details/79702640 https://segmentfault.com/q/1010000003586656

Guess you like

Origin www.cnblogs.com/Benjious/p/12115950.html