Generate stochastic flame graphs for Go programs
Typically, to generate flame graphs, you need a profiler that can intelligently sample trace flow data. With Uber’s go-torch, you can generate flame graphs without needing a profiler because the tool uses Go’s built-in profiler.
The go-torch tool collects trace flow data by stochastically profiling applications that are developed using Go and represents it using flame graphs. Flame graphs are highly useful when performing in-depth trace flow analysis.
Flame graph visualization can also be effective in identifying optimizations that can help applications improve performance and be more scalable. At Uber, go-torch has already proven highly useful in analyzing applications that need to scale with exponential traffic growth.
Stochastic processes such as convergence, stationarity, etc. are built into the core architecture of the library and are used when generating flame graphs. Uber’s go-torch tool comes in handy to process stack trace data of Go programs into rich flame graphs that help visualize the runtime characteristics of a Go application. The tool can capture raw trace flow information from a running application in real-time using Go’s in-built pprof library, or it can work off of a previously generated pprof binary output file. The tool can be used to generate either a flame graph, in the form of an SVG file, or a raw call graph.
The tool can be used to generate either a flame graph, in the form of an SVG file, or a raw call graph.
The capabilities and use cases considered when designing Go-torch are:
- Easy integration with applications - Go-torch can be used with applications that expose pprof endpoints. For applications not running DefaultServeMux, pprof endpoints would need to be manually exposed.
- Go-torch demystifies the “black box” - Go-torch deciphers behind the scenes activity, and enables you to more closely examine trace flow data impacting the various points of your applications.That helps analyze and interpret trend patterns of stack traces.
- Visualizations - Go-torch makes it easy to interpret flame graphs with color and hue, highlighting different trace flows to aid end-to-end visual analysis of the complete data flow. The flame graphs can be output to a file or the SVG content can be displayed on standard output.
- Go-torch prints the raw call graph output to stdout instead of creating a flame graph. Use Brendan Gregg's flame graph Perl script and raw call graph to generate the flame graph.
- Using flame graph, go-torch visualizes the total number of memory allocations in a function, instead of the actual time spent.
- Go-torch can be used against live applications, or previous pprof outputs.
To use Go-torch and integrate with applications, follow the instructions on go-torch readme page.