liveBook · Manning

Profiling

As explained in Cloud Observability in Action

Profiling is the collection and analysis of measurements describing a program's execution behavior, resource usage, or function activity.

Profiling collects and analyzes measurements of a program’s execution: function activity, execution time, CPU use, memory use, goroutines, or other resource behavior. Unlike logs, profiles provide numerical evidence about what a service is doing. section 9.1.1 section 9.1

A profile can be gathered manually or automatically, locally or across longer periods as continuous profiling. Continuous profiling supports troubleshooting, performance optimization, and comparisons between service versions, while profiling remains focused on a service rather than a distributed request path. section 2.5 section 9.1

A practical profiling workflow can include:

  • Expose profiles from an application or collector, commonly through a pprof-compatible HTTP endpoint. section 9.1.1
  • Collect a time-bounded CPU profile, then inspect flat and cumulative function costs in an interactive query interface. section 9.1.1
  • Store and query continuously collected profiles with a tool such as Parca, using visual flame-graph or icicle-graph views. section 9.1.5

Finding an expensive function

A Go service repeatedly runs quickTask() and slowTask() while exposing net/http/pprof. A 30-second CPU profile shows slowTask() accounting for about 49% cumulative runtime, compared with about 6% for quickTask(), turning an otherwise invisible performance difference into an actionable investigation. section 9.1.1

Profiling is useful in development and production, but interpretation and tool selection require care. Formats and tooling do not interoperate perfectly; open-source and commercial options differ, and collection mechanisms such as eBPF or language-specific instrumentation have operational implications. section 9.4 section 11.1.5

How Cloud Observability in Action covers it

How deep it goes
Explains profile types, pprof collection, interactive analysis, and Parca usage, while stopping short of detailed pprof interpretation.
Examples
Uses Go pprof, CPU and goroutine profiles, cumulative function tables, and Parca profiling of an OpenTelemetry collector.
What you can do after
Diagnose/debug with it by locating costly functions and comparing service performance or resource usage across versions.
How it connects
Connects profiling with continuous profiling, logging, metrics, distributed tracing, eBPF, flame graphs, and OpenTelemetry.

Also explained in

Compare how 11 books explain profiling →

Related concepts

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