Ran into a peculiar issue with a discrepancy between what Prometheus and Pprof show the memory usage of a golang app to be. I’m running a go binary in a Kubernetes cluster that has Prometheus setup to monitor all the pods. While testing changes to the binary I hooked into it with pprof which shows the inuse_space
to be ~80mb. Meanwhile, Prometheus shows the memory usage to be ~800, which is 10x what pprof thinks. Has anyone seen this before? I’m inclined to believe the Prometheus number but I’m not sure why pprof isn’t seeing the same thing.
pprof output:
(pprof) top50
Showing nodes accounting for 74.91MB, 100% of 74.91MB total
Showing top 50 nodes out of 86
Prometheus screen grab:
Prometheus calculation:
max(container_memory_working_set_bytes{container="$container",pod="$pod"} / (1024*1024)) by (container)