reference

Found abnormal

After a new release, you need to keep an eye on CPU usage and GC.

  • top -c

    View the running status of cpus, memory, and system load

  • jstat -gc pid 10000

    Check for GC every 10 seconds.

If the CPU usage is too high, the system load is too high, or the number of GC cycles is too high, an exception occurs

Abnormal thread

  • Use top-c, then sort by CPU usage by P

  • Use a top-HP PID, then sort by CPU usage by P

    -h: Displays thread information

    -p: indicates the PID of a process

  • The thread ID shown here is decimal and needs to be converted to hexadecimal.

Thread information

  • Use jstack -l pid >./pid. Stack to convert the stack information to a file

    Dump can be set to dump file using jstack -l pid >./pid.dump can be used for thread analysis using the Stupid platform

  • Use the cat pid. Stack | grep ‘b26’ – C 8 view the stack information

    The filtered thread IDS are in hexadecimal

  • Dump files can also be uploaded to the duma platform for analysis

  • Cat thread information, for example:

    "my-thread-7" #18 prio=5 os_prio=0 tid=0x0000000020c69800 nid=0x3374 runnable [0x0000000021f5e000] java.lang.Thread.State: RUNNABLE at java.io.FileOutputStream.writeBytes(Native Method) at java.io.FileOutputStream.write(FileOutputStream.java:326) at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140) - locked <0x00000006c1c1bb90> (a java.io.BufferedOutputStream) at java.io.PrintStream.write(PrintStream.java:482) - locked <0x00000006c1c14170> (a java.io.PrintStream) at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221) at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291) at sun.nio.cs.StreamEncoder.flushBuffer(StreamEncoder.java:104) - locked <0x00000006c1c1bba8> (a java.io.OutputStreamWriter) at java.io.OutputStreamWriter.flushBuffer(OutputStreamWriter.java:185) at java.io.PrintStream.newLine(PrintStream.java:546) - eliminated <0x00000006c1c14170> (a java.io.PrintStream) at java.io.PrintStream.println(PrintStream.java:807) - locked <0x00000006c1c14170> (a java.io.PrintStream) at com.security.im.controller.login.Test.lambda$main$0(Test.java:56) at com.security.im.controller.login.Test? Lambda$1/1807837413.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)  Locked ownable synchronizers: - <0x00000006c1c1bbf0> (a java.util.concurrent.ThreadPoolExecutor$Worker)Copy the code