离线环境来从现场获取docker的pprof信息步骤
获取go的镜像
while read img;
do docker run --rm --entrypoint go $img version 2>/dev/null | grep -qw version && { echo $img;break; };
done < <(docker images --format '{{.Repository}}:{{.Tag}}')转发docker的sock成tcp
socat -d -d TCP-LISTEN:8081,fork,bind=0.0.0.0 UNIX:/var/run/docker.sock
socat -d -d TCP-LISTEN:18081,fork,bind=0.0.0.0 TCP4:1.1.1.1:30000镜像起容器获取pprof文件
go tool pprof http://1x.xxx.45.162:8080/debug/pprof/goroutine
# 或者
curl -s http://1x.xxx.45.162:8080/debug/pprof/goroutine > test.goroutine
curl -s http://1x.xxx.45.162:8080/debug/pprof/heap
# 然后把`test.goroutine`拿回来转换成pdf
yum install -y graphviz
go tool pprof --pdf test.goroutine > goroutine.pdf
go tool pprof -http=0.0.0.0:8080 test.goroutineother:
curl http://192.168.111.2:8001/debug/pprof/
| Count | Profile |
| 4524 | allocs |
| 0 | block |
| 0 | cmdline |
| 1947 | goroutine |
| 4524 | heap |
| 0 | mutex |
| 0 | profile |
| 10 | threadcreate |
| 0 | trace |
https://www.cnblogs.com/qcrao-2018/p/11832732.html