Cpu Biao high show-busy-java-threads a script online troubleshooting and diagnostic tools to troubleshoot combat Arthas

spring boot racing simulation high code

@Service
public class TestWhile
{
    / * operation memory object * /
    of ConcurrentHashMap Map of ConcurrentHashMap new new = ();
    Private void whileTrue (String threadName) {
        // exit condition is not set, the cycle of death
        the while (to true) {
            // continuously in an endless loop map for the put operation, resulting in memory GC
            for (int I = 0; I <= 100000; I ++) {
                map.put (. Thread.currentThread () getName () + I, I);
            } // End for
        } End the while //
    }
    @PostConstruct
    public void testWhile () {
        // loop size, creating a multi-threaded, concurrent execution of an endless loop
        for (int I = 0; I <20 is; I ++) {
            int Finali = I;
            // and start a new thread calls the method whileTrue
            new new the Thread (() -> {
                whileTrue ( "Li -" + Finali);
            .}) Start ();
        }
    }
}

top

1577416718696-696.png

 

Taobao use open source show-busy-java-threads rapid investigation

  1.  Introduction:
    1. Author: Taobao RiKanae (AkiraRyo) oldratlee
    2. For fast troubleshooting Java CPU performance issues (top us too high), CPU automatically detect many threads running Java process consumes, and print out their thread stack to determine the cause of performance problems method call.
    3.  Git Address: https://github.com/oldratlee/useful-scripts

 Execution: curl -sLk ' https://raw.github.com/oldratlee/useful-scripts/release-2.x/bin/show-busy-java-threads ' | -s bash - -a 2.log  

 2.log output to a file.

1577416959477-763.png

Results: GC-induced CPU racing, [5] due to the thread executing code GC method. WhileTrue method can locate a problem.

 

Taobao use open source Arthas troubleshooting

  1. Description: Arthas is Alibaba open source Java diagnostic tools, the industry's strongest.
  2. GIT Address:  https://github.com/alibaba/arthas/blob/master/README_CN.md
  3. Not only is the CPU thread troubleshooting almost all issues, including the investigation of online decompile, dynamic hot update operation code online request link tracking and more.
-The curl https://alibaba.github.io/arthas/arthas-boot.jar
java -jar arthas-boot.jar

Select the process of investigation required

1  + Enter

Dashboard command execution

1577417445506-590.png

CPU can determine the initial height of GC-induced Biao

 

Execution thread -n 3 -i 5000 View CPU usage Top N thread's stack

1577417597516-899.png

Results: GC-induced high CPU Biao, you can locate a link to the thread run method whileTrue problem.

 

 

Problem recommended in the service, perform the following curl -sLk c ' https://raw.github.com/oldratlee/useful-scripts/release-2.x/bin/show-busy-java-threads ' | -s bash - - -a 2.log then restart, there will be a problem to write this record after restart

 

Guess you like

Origin www.cnblogs.com/atliwen/p/12106503.html