Menu

1 / 5

Zero-config Golang Heap Profiling

DEV Community·Coroot·6 months ago
#6raELOF2
#go#kubernetes#devops#runtime#memory
Reading 0:00
15s threshold

Coroot is an Apache 2.0 open source platform that simplifies observability with no-code configuration. The Coroot node-agent already collects CPU profiles for any process on the node using eBPF , with zero integration from the application side. For Java, we dynamically inject async-profiler into the JVM to get memory and lock profiles. But Go processes were still a blind spot for non-CPU profiling unless the app exposed a pprof endpoint and the cluster-agent scraped it.

We wanted the same zero-config experience for Go heap profiles. This post is about how we got there.

The runtime already profiles

Go's runtime has a built-in memory profiler. On every allocation, the runtime samples with probability size / MemProfileRate and records the call stack. The default rate is 512 * 1024 , or about 1 sample per 512KB allocated.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.