在Debian中監控Go語言性能可使用以下工具和方法:
pprof(內置工具)
net/http/pprof
包,啟動HTTP服務(如http.ListenAndServe("localhost:6060", nil)
)。http://localhost:6060/debug/pprof/profile?seconds=30
生成30秒采樣數據,用go tool pprof
分析。http://localhost:6060/debug/pprof/heap
查看內存分配情況。http://localhost:6060/debug/pprof/goroutine
查看協程狀態。go tool pprof -http=:8081 profile.pprof
。Prometheus + Grafana
prometheus/client_golang
)采集指標(CPU、內存、請求延遲等),存儲到時間序列數據庫。系統工具
第三方工具
操作建議:
參考資料: