borgbase / vorta

Desktop Backup Client for Borg Backup
https://vorta.borgbase.com
GNU General Public License v3.0
1.97k stars 130 forks source link

Provide setting to run scheduled backups with a lower CPU priority #1752

Open daPhipz opened 1 year ago

daPhipz commented 1 year ago

The problem

I use my machine mostly for things that require a lot of computing power. Whenever a backup is running, there is a noticeable delay in the work I do.

Requested Solution

I was wondering if a setting could be implemented that would allow the user to choose whether they want to lower the CPU priority for backup jobs. Like borgmatic does in the systemd service file:

[...]
# Lower CPU and I/O priority.
Nice=19
CPUSchedulingPolicy=batch
IOSchedulingClass=best-effort
IOSchedulingPriority=7
IOWeight=100

Restart=no
# Prevent rate limiting of borgmatic log events. If you are using an older version of systemd that
# doesn't support this (pre-240 or so), you may have to remove this option.
LogRateLimitIntervalSec=0

# Delay start to prevent backups running during boot. Note that systemd-inhibit requires dbus and
# dbus-user-session to be installed.
ExecStartPre=sleep 1m
ExecStart=systemd-inhibit --who="borgmatic" --what="sleep:shutdown" --why="Prevent interrupting scheduled backup" /root/.local/bin/borgmatic --verbosity -2 --syslog-verbosity 1
real-yfprojects commented 1 year ago

Yes, we could implement adjusting the niceness for borg processes. As always you are welcome to open a PR, I can guide you through solving this FR.

shivansh02 commented 5 months ago

Hi @real-yfprojects I'd like to work on this. Can you guide me how to go about this?

m3nu commented 5 months ago

Assigned you. But please suggest your high level solution first. The systemd way above won't work for Mac for example. So this would be implemented per-OS like the network stuff.