Skip to main content
InterviewHubPRO
Section Overview
Q42

Question 42 of 50

Part 4: Production Compilation, Tooling & Senior Engineering (39 - 50)

84%
Golang & Concurrency (50 Qs)•Part 4: Production Compilation, Tooling & Senior Engineering (39 - 50)

How do you analyze CPU and Memory Profiles with `pprof`?

mid LevelgolangProduction Compilation

In Simple Words:

  1. Import _ "net/http/pprof" in your microservice.
  2. Capture a 30-second CPU profile: go tool pprof http://localhost:6060/debug/pprof/profile?seconds=30.
  3. Inspect memory allocations: go tool pprof -alloc_space http://localhost:6060/debug/pprof/heap.
  4. Generate SVG Flame Graphs to pinpoint exact bottleneck functions.