服务开启pprof
https://pkg.go.dev/net/http/pprof
https://golang.org/dl
),用于执行 go tool pprofhttps://github.com/uber/go-torch
),用于调用pprof生成火焰图https://github.com/brendangregg/FlameGraph
) ,用于绘制火焰图apt-get install graphviz
)用于绘制调用关系端口为服务开启http sever 监听的端口(下同)
go-torch -u http://127.0.0.1:1000 -t 30
go tool pprof http://127.0.0.1:1000/debug/pprof/profile
go tool pprof http://127.0.0.1:1000/debug/pprof/heap
go tool pprof -alloc_space http://127.0.0.1:1000/debug/pprof/heap
http://127.0.0.1:1000/debug/pprof/goroutine?debug=1
原文:https://www.cnblogs.com/hellohell/p/15235304.html