go pprof
import _ "net/http/pprof" func main() { go func() { http.ListenAndServe("localhost:6060", nil) }() /** your logic code */ }
you can check the web status by this url : http://localhost:6060/debug/pprof/
#Then use the pprof tool to look at the heap profile: go tool pprof http://localhost:6060/debug/pprof/heap Or to look at a 30-second CPU profile: go tool pprof http://localhost:6060/debug/pprof/profile Or to look at the goroutine blocking profile: go tool pprof http://localhost:6060/debug/pprof/block
pprof info: https://github.com/g0hacker/go_command_tutorial/blob/master/0.12.md