Profiling and Performance Tuning
Use pprof to find where a Go program actually spends CPU and memory, then fix it and prove the fix worked.
Prerequisites: a working Go program to profile — the REST API or gRPC service from earlier projects works well; Working with Go Modules and Testing.
Version note: verified against current docs as of July 2026, targeting the common Go 1.25/1.26 feature set.
net/http/pprof exposes live CPU, heap, goroutine, and mutex profiles over HTTP with a single import; the pprof tool then turns those into flame graphs you can read in a browser. This project profiles a deliberately inefficient function, identifies the actual bottleneck (not the one you'd guess), fixes it, and benchmarks before/after to confirm the fix is real.
Expose live profiling endpoints
Read a CPU profile as a flame graph
Profile heap allocations, then benchmark, fix, and re-benchmark
Secret Mission: Chase a goroutine leak
Before You Go
Test what you just learned
Self-testing is one of the best ways to retain new skills. Unlock project quizzes to check your understanding.
Log in to unlock0 / 6 complete
