pprof如何进行采样:https://studygolang.com/articles/11873
go tool pprof http://localhost:6060/debug/pprof/profile
go tool pprof http://localhost:6060/debug/pprof/heap
go tool pprof http://localhost:6060/debug/pprof/block
go tool pprof http://localhost:6060/debug/pprof/mutex
- cpu(CPU Profiling):
$HOST/debug/pprof/profile
,默认进行 30s 的 CPU Profiling,得到一个分析用的 profile 文件 - block(Block Profiling):
$HOST/debug/pprof/block
,查看导致阻塞同步的堆栈跟踪 - goroutine:
$HOST/debug/pprof/goroutine
,查看当前所有运行的 goroutines 堆栈跟踪 - heap(Memory Profiling):
$HOST/debug/pprof/heap
,查看活动对象的内存分配情况 - mutex(Mutex Profiling):
$HOST/debug/pprof/mutex
,查看导致互斥锁的竞争持有者的堆栈跟踪 - threadcreate:
$HOST/debug/pprof/threadcreate
,查看创建新OS线程的堆栈跟踪