One of the nice things about systemd is that you can change the Nice level and
IO scheduling class/priority in a very simple way. I have recently configured
bacula-fd
on my server in such a way that it will not put a lot of
load on the machine:
cp /lib/systemd/system/bacula-fd.service /etc/systemd/system/bacula-fd.service
Then, open the file with an editor and change the following paragraph:
[Service] Type=forking PIDFile=/var/run/bacula/bacula-fd.9102.pid StandardOutput=syslog ExecStart=/usr/sbin/bacula-fd -u root -g root -c /etc/bacula/bacula-fd.conf
To look like this:
[Service] Nice=10 IOSchedulingClass=best-effort IOSchedulingPriority=7 Type=forking PIDFile=/var/run/bacula/bacula-fd.9102.pid StandardOutput=syslog ExecStart=/usr/sbin/bacula-fd -u root -g root -c /etc/bacula/bacula-fd.conf
And that’s it. See nice(1)
and ionice(1)
for the
possible values. Of course, these attributes are passed on to child processs:
USER PID PRI NI %CPU %MEM COMMAND root 3522 30 10 0.0 0.0 /usr/sbin/bacula-fd -u root -g root -c /etc/bacula/bacula-fd.conf root 23380 30 10 0.0 0.0 \_ /bin/sh /root/bin/xen-lvm-snapshot/foreach-domu.sh mount root 23607 30 10 0.0 0.0 \_ /bin/sh /root/bin/xen-lvm-snapshot/mount-snapshot.sh plana/domu-web root 23665 30 10 0.0 0.0 \_ /sbin/fsck.ext3 -y /dev/loop3