常用命令
直接浏览器访问url
// url
https://confnode3.plaso.cn:7003/debug/pprof
点击allocs
查看内存分配

拉到底部可以看到内存分配信息

点击goroutine
查看正在运行的协程,以及数量;大致估算数量是否正确

点击full goroutine stack dump
查看是否有长时间阻塞的(搜索minutes
)排查阻塞原因
- write to nil chan
使用命令行
查看cpu
go tool pprof https://confnode3.plaso.cn:7003/debug/pprof/profile
// top
// list <函数名>
// web
top
后的参数

list
查看函数调用哪一行耗cpu

web
可以以图形化界面打开,前提要安装graphviz
查看内存
go tool pprof -inuse_space https://confnode3.plaso.cn:7003/debug/pprof/heap
-inuse_space // 默认
-alloc_space // 所有分配过的
-inuser_objects // 对象
网友评论