Open smcgivern opened 1 year ago
This seems similar to https://github.com/google/cadvisor/issues/2634; in our case, if we had LazyFree exposed, we could also take RSS - LazyFree
to get the value we're interested in. It looks like https://github.com/google/cadvisor/pull/2767 went stale, though.
https://github.com/google/cadvisor/compare/master...smcgivern:cadvisor:add-detailed-memory-stats does this, but I'm assuming we'd want to do it conditionally as it adds four metrics series to everywhere we collect memory metrics.
Currently, cAdvisor reports the following memory stats: https://github.com/google/cadvisor/blob/ce07bb28eadc18183df15ca5346293af6b020b33/container/libcontainer/handler.go#L802-L844
usage - inactive_file
In our case, we'd like more detailed metrics. We find that working set is often over what we want to account for (https://github.com/google/cadvisor/issues/3081 is one example), because, to quote a colleague:
memory.stat
includesactive_anon
,inactive_anon
,active_file
, andinactive_file
(among others) but these are not exposed by cAdvisor currently: https://docs.kernel.org/admin-guide/cgroup-v1/memory.html#stat-fileWould you accept a patch to add those?
(Side note: we'd like to use RSS instead of WSS, but then we run into issues with programs that use
MADV_FREE
. Go dropped this in https://github.com/golang/go/issues/42330, but programs in other languages may still use this, which inflates RSS above what might be expected.)