Go pprof Operations
Jump to navigation
Jump to search
Internal
Make Sure an Executable Starts with the Profiling Subsystem Enabled
TODO
Connect with a Browser to an Executable that Has the Profiling Subsystem Enabled
Go to https://127.0.0.1:8443/debug/pprof/
If the process has TLS enabled, see TLS and Certificates for suggestions on how to address the issue.
Dump Profiles
Once a Go executable is started with the profiling subsystem enabled, you can use curl
to connect to the embedded web server and dump various profiles.
The general syntax of the command is:
curl -k https://localhost:<http-port>/debug/pprof/<profile-name>[?debug=1|2]
where profile name can be one of goroutine
, heap
, threadcreate
, block
, mutex
.
For example, to dump goroutines:
curl -k https://localhost:<http-port>/debug/pprof/goroutine?debug=2 > ~/tmp/goroutine-profile.txt
TLS and Certificates
go tool pprof
go tool pprof
is the tool to analyze the profiles collected from the Go process.
The tool can analyze profile collected previously, or it an attach to a live process and start a web server that allows live interaction.