Open Jongy opened 1 year ago
The same can be applied on CPU limits
Hello @Jongy! I am interested in working on this issue. Can I be assigned to it?
Hi @Creatone ! You're welcome to try it :)
Let's define an MVP:
move_to_cgroup
and handle the raised exception if we're already in a cgroup).--limit-memory
and --limit-cpu
which override the defaults. Units are bytes for memory (int) and cores (float, 1 == 1 core) for CPU. If -1
is given it implies no limit, but you can still move to the cgroup, as this can help us do measurements of utilization, as explained in https://github.com/Granulate/gprofiler/issues/227. After this issue (#529), I want --log-usage
to work for exe mode as well (i.e I expect this issue to resolve #227 as well).--no-cgroups
to avoid doing ANY cgroups changes (moving / changing limits etc). It's always helpful to have a kill switch.Good luck :)
The easiest way to place a hard limit on the memory used by gProfiler, as gProfiler is a privileged app, is to use cgroups. We have such API in granulate-utils - see this file. We can use it to place gProfiler in a cgroup & set its limit to e.g 1GB to ensure we don't grow too much, e.g due to https://github.com/Granulate/gprofiler/issues/528