Profiling and optimizing Go web applications
Go has a powerful built-in profiler that supports CPU, memory, goroutine and block (contention) profiling.Enabling the profilerGo provides a low-level profiling API runtime/pprof, but if you are developing a long-running service, it's more convenient to work with a high-level net/http/pprof package.All you need to enable the profiler is to import net/http/pprof and it will automatically register..