a program uses resources like CPU or memory at code-level granularity. It makes use of flamegraphs to help you pinpoint the parts of your application that use the most resources. Commonly used during application development, built into popular IDEs. Challenges: • The overhead of conventional profiles don’t allow for profiling in production • On-demand profiling is a reactive approach • Development environments don’t accurately mimic production.
profiling technologies allows for it to run in production, with minimal overhead. This allows for “Continuous profiling” which is a more powerful version of profiling which profiles applications periodically, adding the dimension of time. By understanding your system’s resource usage over time, you can then locate, debug, and fix issues related to performance.
are allows you to optimize them The value of Continuous Profiling Latency reduction Incident resolution For many businesses performance impact revenue - e-commerce, ads - gaming, streaming - HFT, fintech - rideshare Pinpoint memory leaks to specific parts of the code See root cause of CPU spikes See code level details when debugging services
◦ Tooling and formats depending on each language ecosystem ◦ Access to more detailed runtime information ◦ More flexibility: ▪ selectively profile and label specific sections of code ▪ send profiles at different intervals (further read: eBPF pros/cons) • eBPF based collection ◦ No insights into stacktrace runtime information for interpreted languages (better fit for compiled languages) ◦ Focus on CPU profiling ◦ Live profiling: doesn’t require code change or even restarts ◦ Kernel dependencies (v4.9 or more recent) and requires root access
Go • Standard library includes CPU, Memory, Goroutine, Mutex and Block resources • Provides profiles using a HTTP interface ◦ Profiling data is returned using protobuf definition • Data meant to be consumed by the pprof CLI ◦ # Get a CPU profile over the last 2 seconds $ pprof "http://localhost:6060/debug/pprof/profile?seconds=2" # Get the heap memory allocations $ pprof "http://localhost:6060/debug/pprof/allocs" ◦ Common to use the -http parameter to view profiles using the web interface • Find more on Profiling in Go on https://pkg.go.dev/runtime/pprof#Profile
GitHub ⭐ Commercial Managed Offering An open source continuous profiling platform Grafana Cloud Profiles available in Grafana Cloud (available with free tier) • Fully managed Grafana and observability solution