Setting up cgroups on Ubuntu

Michał Sawicz michal at sawicz.net
Tue Oct 23 17:14:20 UTC 2018


W dniu 23.10.2018 o 09:57, Dimitri John Ledkov pisze:
>> Hey all,
>>
>> Is there a recommended way of setting up cgroups on Ubuntu? I see we
>> don't have `cgrulesengd` set up as a service, so is just running
>> `cgconfigparser` on boot and using `cgexec` the recommended approach?
>>
>> Or even dealing directly with the cgroups filesystem?
>>
> This is a very low-level question, which feels like one is jumping to
> conclusions/solution without stating the problem/user-story/goal. Can
> you elaborate and start from the beginning and what prompted you to
> find cgrulesengd?
> 
> All system, user, and container processes on Ubuntu are segregated
> into cgroups with a default equal balancing of resources. And one can
> further adjust resource allocations using service, slice, scope
> settings. Or use delegation for further management. There are examples
> of using all of those things by various things in Ubuntu by default...
> but it's hard to point you at something specific, without at all
> knowing what is your actual use case.
> 
> Also, I'm not sure if you are trying to escape default allocation and
> get a bigger slice, or on the contrary further sub-divide the
> resources your process was given.

Hey,

OK let me track back:

I'm asking this in the context of multipass - when memory in the
instance is exhausted, the virtual machine becomes unresponsive, there's
no way to investigate what's going on, and the OOM killer doesn't seem
to be able to kick in either. There's no swap configured, btw, but we
wouldn't like to add that.

So what we wanted to do is limit the memory usage of user-invoked
commands (those via `multipass exec`) to leave a minimum amount of
memory free so that you can always access the vm.

So the plan was to create a cgroup limited to a certain amount of memory
and put all the tasks created through `multipass exec` in there.

That led me to cgconfigparser / cgrulesengd, but I couldn't find much in
terms of a "guide" on how it's recommended to work it on Ubuntu.

HTH,
-- 
Michał Sawicz <michal at sawicz.net>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/ubuntu-devel/attachments/20181023/ed780248/attachment.sig>


More information about the ubuntu-devel mailing list