Recently, I've run into some issues with my system. I have scheduled tasks that are supposed to make my life easier by automatically doing maintainence for me. The problem is that, if I happen to be using my PC while these tasks run, it slows down everything and interferes with my productivity. I could disable the tasks when I'm using the computer, but that doesn't seem like a good enough solution, since I want to have them run no matter what, I just want them to not bother me. It turns out that SystemD has some fairly advanced resource management capabilities. Most people don't have a reason to use these settings because they will be preconfigured by the distro or system admin, but for someone like me that has a very customized local configuration, they can come in handy.
SystemD can use Linux CGroups to set restrictions on service resource access. In my case, I'm interested in CPU and disk access, although CGroups are much more flexible than what I need.
I found the services which were slowing down my computer and ran the following commands:
systemctl set-property <service> CPUQuota=50% systemctl set-property <service> CPUWeight=1 systemctl set-property <service> IOWeight=1
This changes, only for the current boot (the settings are lost on system shutdown), the resource access for