模拟故障程序
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
for (;;){
Thread thread = new Thread(() -> {
System.out.println("hello world");
});
thread.start();
}
}
}
把故障程序上传到空闲服务器
执行命令后台运行,如果直接运行或直接造成 shell连接工具卡顿
nohup java -jar xxx.jar &
使用top
或者htop
命令查看 进程列表
cpu占用率排在第一位的java进程就是我们运行的故障程序