Go Tool Trace
淺談 Go Tool Trace - 1 淺談 Go Tool Trace - 2 Go Trace 與使用者自訂追蹤分析 淺談 Go Tool Trace - 3 實際分析 Goroutine Analysis Go Tool Trace - 4 從 分析到實戰:最佳化 Goroutine 數量 trace Trace is an “event timeline”, not “sampling statistics”
go tool trace: used to inspect runtime traces. Its essence is a time-ordered event stream, including: goroutine lifecycle/states: create / runnable / running / waiting / syscall scheduler (G/M/P) related events, scheduling latency blocking time distribution (net / sync / syscall) GC events, STW, heap changes (visible in the trace viewer) Use pprof to find hot spots: who burns CPU, who allocates a lot Use trace to find latency causes: why it’s stuck (scheduling? locks? network? syscalls? GC?) Quick intuition: