-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Make cache reclaim support v2 #8497
Comments
I research how to implement cache reclaim. First of all, cgroup v2 doesn't have a way to reset the page cache in units of tasks. So we have to consider the new algorithm for the cache reclaim.
In other words, when low ~ min or vice versa, the kernel will reclaim the memory. We need to think a bit about how to set the min and max values, but we may be better off relying on these instead of having our own memory reclaim. And there is currently nothing else in cgroup v2 to rely on to implement the cache-reclaim. Also, in cgroup v2 kubernetes, kubelet will make decisions based on memory usage including page cache. Reference |
I've researched the effects of cgv2 $ tar cvvfz $HOME/backup.tar.gz /workspace Then, in another terminal, I ran the following measurement command. $ while true; do sleep 1; (echo $(date +%s), $(cat /sys/fs/cgroup/memory.current)) >> /tmp/log.txt; done Details is here. I'm going to investigate the following a bit more, basically leaving the reclaim to the linux kernel.
Also, if there are no particular problems after investigating these, I would like to consider what values would be appropriate to set. For example, 80% of the actual limit of the workspace. @csweichel @Furisto WDYT? |
|
@Furisto I had made a big mistake 😭 All of the above results are setted to high, not max. The data is correct, but I had mistakenly written high as max. |
Additional research was done. I set the #!/bin/bash
set -e
while true; do
stress-ng -m 1 --vm-bytes $1 --timeout 30 # $1 = 20GB
sleep 30
done a script for logging#!/bin/bash
set -e
file=/tmp/$(date +%s)_log.txt
echo start logging to $file
cat /sys/fs/cgroup/memory.stat | awk '{ print $1 }' | xargs echo memory.current >> $file
while true; do
sleep 1
echo $(cat /sys/fs/cgroup/memory.current) $(cat /sys/fs/cgroup/memory.stat | awk '{ print $2 }' | xargs echo) >> $file
done If the kernel exceeds the value of Detailed survey results are here. I would like to present two paths:
Rely on kubernetes memory QoSkubernetes has a QoS feature that uses cgroup v2. The default seems to be to set 👍 good
🤔 not good
Set a fixed value to
|
@Furisto @csweichel I'd like to hear what you think. And if you have any other good ideas, I'd love to hear them. |
Thanks @utam0k for the level of detail - much appreciated. It strikes me that option 1 would be the way forward. We could just live with the 80% setting and see how things behave in prod. Re implementing the memory limit: how would the system behave if we lowered |
Agreed, this option would be the most straightforward solution. We still can switch to another option if it turns out that this is not sufficient for us.
Yes, depending on the value of memory.oom.group it would either kill some or all processes inside the cgroup. Processes with an oom_score_adj set to -1000 will not be killed. |
@csweichel @Furisto |
No description provided.
The text was updated successfully, but these errors were encountered: