Skip to content

Taking a Heap, CPU or other profile Dump

Aidan Oldershaw edited this page Jul 22, 2021 · 8 revisions

To analyze one of the pprof profiles available for Go for Concourse we can leverage http://127.0.0.1:DEBUG_BIND_PORT/debug/pprof endpoint. The value of DEBUG_BIND_PORT depends on what process you are inspecting. For the web process, the default port is 8079. For the worker process, the default port is 7076. These values can be overridden by the CONCOURSE_DEBUG_BIND_PORT environment variable.

For example to get a heap dump, run;

Web

curl http://localhost:8079/debug/pprof/heap > DUMP_FILE

Worker

curl http://localhost:7776/debug/pprof/heap > DUMP_FILE

Or if you are looking for the MemStats, run;

Web

curl http://localhost:8079/debug/pprof/heap?debug=1 > DUMP_FILE

Worker

curl http://localhost:7776/debug/pprof/heap?debug=1 > DUMP_FILE

This can be analyzed using;

go tool pprof -http :SOME_PORT_NUMBER PATH_TO_DUMP_FILE

Tips

  • For MemStats, open the DUMP_FILE with a text editor and look at the # runtime.MemStats section. This is only available when passing the debug=1 query param to the pprof endpoint.
  • go tool pprof has -diff_base and -base to compare profiles

Resources