Dev.to
6/30/2026

Profile Go services in production with pprof in 10 minutes
Original: Profiling a Go Service in Production: pprof in 10 Minutes
Short summary
Go includes a production profiler (pprof) accessible over HTTP without external tools or instrumentation. A single import enables endpoints for CPU, memory, goroutine, and mutex profiles; flame graphs reveal where your program spends time and expose bottlenecks. The guide covers three common worker-pool patterns: excess allocations (fixed with sync.Pool), goroutine leaks (unclosed channels), and mutex contention (profiled under load).
- •pprof is Go's built-in profiler; enable with one import and access via HTTP endpoints
- •Use flame graphs to visualize CPU time; wider bars indicate functions consuming more CPU
- •Three common patterns: allocation hotspots (sync.Pool reuse), goroutine leaks (defer close), mutex contention (test under load)
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



