Profiling Code II
Explore how to profile Go HTTP servers by using the net/http/pprof package. Understand how to collect profiling data during server runtime, access profiling handlers, and analyze performance with the go tool pprof web interface. This lesson helps you optimize and troubleshoot HTTP server applications in Go.
We'll cover the following...
Profiling an HTTP server
As discussed, the net/http/pprof package should be used when we want to collect profiling data for a Go application that runs an HTTP server. To that end, importing net/http/pprof installs various handlers under the /debug/pprof/ path. We are going to see more on this in a short while. For now, it is enough to remember that the net/http/pprof package should be used to profile web applications, whereas runtime/pprof should be used to profile all other kinds of applications.
Coding example
The ...