Tag Archives: pprof
How to work with core dumps of Go programs
If you want to check what is going on in your service during load (on production or during stress testing process), you can take a core dump of your app and load it into Goland for further debugging.
1 2 3 4 5 6 |
# first you need to get your app's PID ps aux|grep <your-app-bin-name> gcore <PID> # download dump file and binary file to a local machine with kubectl cp <some-namespace>/<some-pod>:/core.<PID> ~/Downloads kubectl cp <some-namespace>/<some-pod>:<your-app-bin-path> ~/Downloads |
Then open it your Goland: Navigate to Run | Open Core Dump. In the Executable field, …
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 CPU profiling After that you can run something like this in shell:
1 |
go tool pprof -png ~/Downloads/profile |
Or just open it in the browser:
1 |
go tool pprof -http=:1234 ~/Downloads/profile |
If it opens something different then your browser (sublime …