What commands are used for Linux system monitoring?

  
                

There are a lot of commands for Linux system. Today, we mainly introduce Linux system monitoring commands. If you are interested in monitoring commands or are learning related knowledge, you may wish to understand.

Find the most CPU-intensive java thread

ps command

Command: ps -mp pid -o THREAD,tid,time or ps -Lfp pid

the results show:

this command behaves, mainly can get some information corresponding thread in a process. For example, if you want to analyze some of the running bottlenecks of a Java process, you can use this command to find the CPU usage time of all current Threads, which is the last column here.

For example, here found a TID: 30834, which takes up the highest TIME time.

By printf “%x\ ” 30834 First converted to hexadecimal, continue to dump the current jvm process stack information through the jstack command. With the Grep command, you can find the hexadecimal thread id information, and you can quickly find out where the most CPU-intensive code is.

simple explanation, the string of the thread jstack content:

Java codes

& ldquo; DboServiceProcessor-4-thread-295 & rdquo; daemon prio = 10 tid=0x00002aab047a9800 nid=0x7d9b waiting on condition [0x0000000046f66000]

nid : The corresponding linux operating system tid is the hexadecimal number converted in the front

tid: This should be jvm The unique address location in the jmm memory specification, if you use some of the memory data of jvm in detail, I have not yet reached that level, so first put down

top command

command: top -Hp pid

the results show:

and in front of the effect look, you can get real-time tracking and thread the specified process consuming the most cpu's. Then use the previous method to extract the corresponding thread stack information.

Analyzing I /O bottlenecks

mpstat command

command: mpstat -P ALL 1 1000

The results show:

Note the %iowait column inside, the time it takes for the CPU to wait for an I/O operation. This value continues to be high and is usually caused by an I/O bottleneck.

This parameter can be used to see if there is a bottleneck in the current I/O operation.
Previous12Next page Total 2 pages

Copyright © Windows knowledge All Rights Reserved