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
Use cgroups for limiting memory usage #2398
Conversation
1309838
to
c3e0dc8
Compare
09c9e3b
to
cb62833
Compare
cb62833
to
d890c11
Compare
We extensively tested (@Williangalvani and me) for two hours changing the memory limit, as well as playing with other controls not used on this PR, like the As a next improvement, we should be able to configure the |
Useful commands inside the docker: # Check if any process has been hitting memory limits and/or has been killed by the OOM.
cat /sys/fs/cgroup/$DOCKER_CGROUP/*/memory.events
# Check the current memory of any service:
cat /sys/fs/cgroup/$DOCKER_CGROUP/<cgroupname>/memory.*current ...and RedHat has a good resource about how to monitor it here. The most useful command is, from outside the docker: systemd-cgtop |
time to get this in? |
ssh -i /root/.config/.ssh/id_rsa -o StrictHostKeyChecking=no pi@localhost "$1" | ||
} | ||
|
||
prepare_cgroups() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should test the ssh_command is working, if not, we should abort this process and continue the start script.
The reason behind this is that the start script is the root of the entire BlueOS, it can't fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
core/start-blueos-core
Outdated
|
||
echo "Creating a new child cgroup..." | ||
# Create a new child cgroup | ||
mkdir /sys/fs/cgroup/$DOCKER_CGROUP/child_cgroup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should create a variable for /sys/fs/cgroup/$DOCKER_CGROUP, since it's used so many times
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@patrickelectric can you try it on docker compose? I'm having some iptables issues |
Would be nice if we could include some notes about this in the BlueOS-core dev docs, if/when it gets merged in. |
Everything appears to be fine with compose |
fix #2393
fix #2387
fix #2378