[systemd-devel] restricting resource of a process within a service
Lennart Poettering
lennart at poettering.net
Tue Oct 24 08:23:17 UTC 2017
On Di, 17.10.17 18:21, Armen Baloyan (armen.baloyan at daqri.com) wrote:
> Hi,
>
> I need to restrict CPU usage for a process that runs in a service. The
> service has over 10 processes running but I need to put restrictions only
> on 1 of those processes.
As Colin already pointed out, the usual way is to split up that
service into multiple services that can be individually managed in
regards to resource consumption.
Note that if you want to limit he total CPU time consumption you can use classic
UNIX resource limits for this, i.e. RLIMIT_CPU. But this puts a hard
limit on the total CPU runtime, it's not a way to say "this processes
gets only 10% of the cpu time of each second runtime"...
> Is it possible to move this process to a separate cgroup or it cannot be
> removed its service's cgroup?
You can open a scope unit for a specific process, programatically via D-Bus.
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list