Back to course

Performance Profiling with pprof

Go (Golang) for Cloud-Native Microservices

Finding Bottlenecks

Go has a built-in profiler called pprof. It can tell you exactly which function is consuming CPU or Memory.

Enabling pprof:

go import _ "net/http/pprof" go func() { log.Println(http.ListenAndServe("localhost:6060", nil)) }()

Then use go tool pprof to analyze your running microservice.