| 定位进程 | docker stats --no-stream;docker top myapp 看容器内进程 |
|---|---|
| 容器内 | exec 进去 top -b -n1 / ps aux --sort=-%cpu |
| 限流检查 | cat /sys/fs/cgroup/.../cpu.stat 的 nr_throttled/throttled_time |
| 常见根因 | 死循环、正则回溯、GC 频繁、日志风暴 |
| 手段 | 线程栈/pprof 抓现场;需要时临时降权或限流 |
排查命令
排查命令
docker stats --no-stream myapp
docker top myapp
docker exec myapp sh -c 'ps aux --sort=-%cpu | head -10'
docker exec myapp cat /sys/fs/cgroup/cpu.stat 2>/dev/null | headCPU 突刺还可能是宿主争抢(steal):容器内看不出,宿主 top 的 st 指标能确认。