Interview chain gun series (eight): server CPU soared 100% how to troubleshoot

  1. Server CPU soared 100% how to troubleshoot
    the implementation of "top" command to see real-time CPU usage of the current process, PID column is the process ID, determine which is the problem of the application.

  2. If the cause is a Java application, how to locate the fault
    1. The implementation of "top -Hp process ID" command: View of all threads in java process CPU-intensive.
    2. Execute "printf"% x \ n 10 "command: subsequent viewing thread stack information is displayed in hexadecimal, in order to find our thread stack information, the thread turn into a hexadecimal number, for example, printf."% X \ n 10- "prints: a, then jstack the thread number is 0xa.
    3. The implementation of "jstack process ID | grep thread ID" find a process under - "thread ID (nid jstack stack information) = 0xa the thread stack information. If "" VM Thread "os_prio = 0 .tid = 0x00007f871806e000 nid = 0xa runnable", the first double quote is to ring up the thread name, if it is "VM Thread" This is a virtual machine GC collection threads.
    4. The implementation of "jstat -gcutil process ID statistics count the number of milliseconds (default unanimously statistics)" to see continued changes in a process GC, if found to return and has been a great increase in FGC - "! Full GC can also be used to confirm" jmap -heap process ID "look in the heap process from is not to overflow, especially in the old years, from the use of generally reaches a threshold value (specifically to see the garbage collector and the configured threshold at startup) will process Full GC.
    5. The implementation of "jmap -dump: format = b, file = filename process ID", exported under a process memory heap output to a file. The mat can eclipse tool to see which memory has more number of objects.
  3. There are several reasons for frequent Full GC
    1. Create a large number of objects can not be recovered.
    2. Frequent display call System.gc ().
  4. If the deadlock is, how it checks
    the implementation of "jstack process ID | grep thread ID" find the thread stack information corresponding to the keywords appear deadlock indicates that a deadlock can be seen through the stack information specific chokepoint two threads.

Reference (excerpt of the text portion of the original author belongs Rights):

https://mp.weixin.qq.com/s/g8KJhOtiBHWb6wNFrCcLVg

Chicken Soup: Do not lose weight, and not just because you ugly fat.

Guess you like

Origin www.cnblogs.com/xiaoyangjia/p/11582670.html