liveBook · Manning

Pprof

As explained in Fast by Default

pprof is Go's profiling toolset for collecting and analyzing CPU, memory, and other runtime profiles.

pprof is Go’s profiling toolset for collecting and analyzing runtime profiles. For memory investigations, it exposes a heap profile through an HTTP endpoint, allowing analysis of a running service. section 7.2.4

Use pprof to identify memory that grows unexpectedly:

  • Capture a heap profile after startup with go tool pprof http://localhost:6060/debug/pprof/heap. section 7.2.4
  • Run representative traffic through the service, then capture a second profile. section 7.2.4
  • Use pprof’s diff mode to determine which allocations grew between snapshots. section 7.2.4
  • Compare the result with expected lifetime: request data should disappear, while caches and configuration objects should remain bounded. section 7.2.4

How Fast by Default covers it

How deep it goes
Explains an operational capture-and-diff workflow but does not detail pprof’s internal profiling implementation.
Examples
Uses a localhost heap endpoint, startup and post-traffic profiles, and a before-and-after memory-growth comparison.
What it assumes
Assumes a running Go service that exposes pprof’s HTTP profiling endpoints and can receive representative traffic.
What you can do after
Diagnose memory growth with pprof by capturing heap profiles and comparing allocation changes after traffic.
How it connects
Connects memory profiling with heap profiles, HTTP endpoints, CPU profiling, and container deployments.

Also explained in

Compare how 3 books explain pprof →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Fast by Default. The section links point to the parts of the book it draws on.