2

I'm trying to implement a solution to this problem using control groups, which I have never worked with before. As a first step, I thought I would create a control group, add a process to it, and view its memory usage.

I ran the following code:

sudo apt install cgroup-tools
sudo cgcreate -g memory:/jupyterHub
sudo cgclassify -g memory:/jupyterHub --sticky 805

805 here is the jupyterhub process. Ultimately, I want to limit the memory usage of 805 and all of its children, so that the OOM-killer is invoked when the memory usage is too high. When I run

sudo ps -o cgroup 805

it shows the jupyterHub group as expected.

However, when I run

sudo cgget -g memory:/jupyterHub

it reports 4KB of memory usage, which is definitely wrong and I'm pretty sure corresponds to the process using zero memory.

systemd-cgtop

gives the same result. How can I create a control group containing jupyterhub and its children that will report the correct amount of memory usage?

Also, please tell me if I'm doing something dangerous here (although I'm already planning on creating a duplicate server for testing so that I don't bork up the production one).

1
  • I have a very few knowledge about cgroups. And what I've known is that to manage cgroups you can use systemd (I'd prefer learning to use cgroups by the commands rather than using systemd). Maybe you have to enable/disable some option in your system (maybe kernel parameters in /etc/default/grub). Or maybe you are using the wrong cgroups version since there v1 and v2 Commented Jan 18, 2023 at 3:27

0

You must log in to answer this question.

Browse other questions tagged .