liveBook · Manning

Flame graph

As explained in Cloud Observability in Action

A flame graph is a hierarchical visualization of collected stack traces in which horizontal extent represents call frequency or resource consumption and vertical position represents stack depth.

A flame graph visualizes collected stack traces hierarchically. The horizontal axis represents collected stacks, call frequency, or resource consumption—not time—while the vertical axis represents stack depth. Each rectangle represents a function call or operating-system syscall; its width indicates invocation count or running time. The top rectangle is the function running when the stack was collected. Colors mainly distinguish frames and carry no inherent semantics. section 9.1.2

Use flame graphs to inspect profiling signals and locate expensive execution paths:

  • Compare horizontal widths to find functions consuming substantial CPU time or appearing frequently in samples. section 9.1.2
  • Follow vertical parent-child relationships to understand which callers lead to an expensive function. section 9.1.2
  • Apply the visualization beyond CPU profiling, including memory and network I/O analysis. section 9.1.2
  • Treat production use cautiously because continuous profiling can impose resource impact and may disrupt workloads. section 9.1.5

Reading a pprof profile

A Go pprof example shows slowTask() occupying much more CPU than quickTask(). The graph also shows slowTask() called from main(), allowing the reader to connect resource consumption with its calling path. A protobuf-encoded pprof profile supplies the collected profiling data that the visualization renders. section 9.1.2 section 9.4

Figure 9.2 An flame graph using our pprof Go example

Inspect the pprof flame-graph figure to connect rectangle width, stack depth, and the slowTask() call path. section 9.1.2

How Cloud Observability in Action covers it

How deep it goes
Explains axes, rectangles, colors, and resource scope with a worked pprof example, but defers detailed rendering internals.
Examples
Demonstrates a Go pprof profile where slowTask() dominates CPU time and appears beneath main().
What it assumes
Assumes collected profiles and basic call-stack terminology, while defining the graph’s axes and frame structure directly.
What you can do after
Diagnose CPU, memory, or I/O bottlenecks by reading widths, stack depth, and caller relationships.
How it connects
Connects flame graphs with stack traces, continuous profiling, pprof, CPU profiling, memory profiling, network I/O, and icicle graphs.

Also explained in

Compare how 2 books explain flame graph →

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.