profiling go code
play

Profiling Go Code FLAME GRAPHS Ram Nadella Online Marketplace CPU - PowerPoint PPT Presentation

Profiling Go Code FLAME GRAPHS Ram Nadella Online Marketplace CPU Flame Graph of Linux Kernel Flame Graphs Function call stacks Each cell => Function Width => cost of the function Colors have no meaning Flame Graphs


  1. Profiling Go Code FLAME GRAPHS Ram Nadella

  2. Online Marketplace

  3. CPU Flame Graph of Linux Kernel

  4. Flame Graphs • Function call stacks • Each cell => Function • Width => cost of the function • Colors have no meaning

  5. Flame Graphs • SVG file • Interactive

  6. Generating CPU Flame Graphs • Use perf/stap/dtrace to generate call stacks • Collapse stacks & generate SVG file brendangregg.com/FlameGraphs/cpuflamegraphs.html

  7. Go

  8. Setting up import _ “net/http/pprof"

  9. Setting up import _ “net/http/ pprof "

  10. pprof • Registers http handlers that expose profiling actions • /debug/pprof/profile • /debug/pprof/trace • /debug/pprof/heap

  11. Setting up package main import _ "net/http/pprof" func main() { … go func () { http.ListenAndServe(":27590", nil) }() … }

  12. Setting up package main import _ "net/http/pprof" func main() { … go func () { http.ListenAndServe(":27590", nil) }() … }

  13. Profiling Go Code: Flame Graphs > go get https://github.com/uber/go-torch > git clone https://github.com/brendangregg/FlameGraph > go-torch --time=10 --file “torch.svg" \ --url http://<host>:<port>

  14. Profiling Go Code: Flame Graphs > go get https://github.com/uber/go-torch > git clone https://github.com/brendangregg/FlameGraph > go-torch --time=10 --file “torch.svg" \ --url http://<host>:<port>

  15. Search – stats*

  16. References • Flame Graphs • go-torch

Recommend


More recommend