-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Metric container_memory_working_set_bytes
includes slab
reclaimable memory
#3081
Comments
Good question! I don't want to overcrowd this issue, but why we don't subtract |
@bwplotka I can understand why Is |
Yea, agree, something is off, but for me, it's not really slab. I can reproduce this problem with a large number of open file descriptors. The WSS shows quite large memory usage: (file_mapped = 0) Stat file:
Now, what's interesting dropping all cache pages on the host machine using Simply dropping cache from WSS is no-go as cache is extremely large, yet kind of affecting the WSS: Stats after:
|
Why is not the Active(file) memory subtracted as well? I observe on my containers that the Active(file) memory is high even after a memory-heavy job ends, and the container_memory_working_set_bytes remains at a high value. From what I understand, even the Active(file) memory is reclaimable, although it has a lesser priority than InActive(file). |
@saswatac you don't want to subtract active file because the working set is meant to give you a metric for the active memory your container needs. Every app needs some file cache. If you just ignore that when assigning memory requests for your app it will degrade the performance. |
I think that "container_memory_working_set_bytes" should contain only unreclaimable mem, only in this way it'll be possible to effectively use this metric for scaling and as alert before OOM. In my example, I have 1 GB of mem in slab_reclaimable, application itself consume only 100MB. Is any update on this? Can I make PR to fix that? |
I ran into a somewhat unique situation in which a POD had very high slab memory - high as in 1.1GB worth. In terms of anonymous and active file the memory usage was only around 25MB. Working set calculate shows 1.1GB due to the fact that slab reclaimable memory isn't subtracted from
workingSet
calculation.Working set calculation
Where
MemoryStats.Usage.Usage
is the value frommemory.current
(cgroup v2) ormemory.usage_in_bytes
(cgroup v1). Memory statistics (memory.stat) contains the following fields:Of which
slab_reclaimable
is memory that can be reclaimed by the OS when needed. Should we be subtracting this value when calculatingworkingSet
?The text was updated successfully, but these errors were encountered: