vostok / metrics.system

Cross-platform system metrics collection for .NET Core applications.
MIT License
3 stars 2 forks source link

CurrentProcessMetrics: MemoryResident on Linux probably should not include shared memory pages (e.g. system file cache) #8

Closed iloktionov closed 3 years ago

iloktionov commented 3 years ago

https://kontur.slack.com/archives/C08DRHZTP/p1613558381350700

HolyPrapor commented 3 years ago

I agree that we shouldn't include shared memory pages in this metric, because they don't provide very useful info about application memory usage.

Having RssAnon instead of VmRSS is informative enough.

Of course, if we could calculate RssAnon + something like shared that is used by no one but me metric it would be more useful, but there is no easy way to calculate this.

There is also a metric called PSS. It looks much more useful, and can be retrieved in /proc/[pid]/smaps.

But the doc placed a warning under /proc/[pid]/statm: "Some of these values are inaccurate because of a kernel-internal scalability optimization. If accurate values are required, use /proc/[pid]/smaps or /proc/[pid]/smaps_rollup instead, which are much slower but provide accurate, detailed information."

So I think that the game is not worth the candle, and we should just use RssAnon instead of VmRSS.