How to analyze the performance of your go application in production

You should definitely use chi’s middleware for running pprof and stuff in your admin panel.
That’s the repo — https://github.com/go-chi/chi

That’s the profiler — https://github.com/go-chi/chi/blob/master/middleware/profiler.go

After that you can run something like this in shell:

If you run into problems with graphviz like this Failed to execute dot. Is Graphviz installed? Error: exec: "dot": executable file not found in $PATH, just install it with brew install graphviz.

Also you can just start watching it interactively with

Inside pprof you can run commands like top -cum or list (like list main.main).

Trace profiles can be watched by

There is a nice video on that:

https://www.youtube.com/watch?v=ySy3sR1LFCQ

LEAVE A COMMENT