I would like to use Linux control groups (cgroups) to limit CPU and RAM usage of multiple processes. If the processes are Process 1
and Process 2
with child process Process 2 Sub
, would this be the correct, minimal command syntax:
sudo systemd-run --scope -p MemoryHigh=200M Process\ 1
-p MemoryHigh=200M Process\ 2
-p MemoryHigh=200M Process\ 2\ Sub
-p MemoryMax=250M Process\ 1
-p MemoryMax=250M Process\ 2
-p MemoryMax=250M Process\ 2\ Sub
-p CPUQuota=10% Process\ 1
-p CPUQuota=10% Process\ 2
-p CPUQuota=10% Process\ 2\ Sub
I'm uncertain about the correct process ID (full path? process name?), the "chaining" of options, case sensitivity, escaping blank spaces, if child processes (here: Process 2 Sub
) are automatically included in the imposed limits or need to be controlled individually, and if this command needs to be run every time the process in question is started or if the settings are permanent. Thx!
systemd-run creates a new scope and launches a program inside of it.
The syntax to use is:
systemd-run --scope -p MemoryMax=250M -p MemoryHigh=200M /path/to/program/to/use
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With