Backup Exec on Linux, otherwise known as RALUS, is great but it has no provisions for limiting it’s disk I/O or CPU usage during different periods of the day. Unfortunately, BE for Windows doesn’t have that option either, so get on it Symantec, nudge, nudge.
If you’re like me, you might have backup jobs on File Servers that span several terabytes worth of data that can essentially run for a day or two on their own. The problem is that people get really bitchy when things don’t run at the normal speed that they are used to and the inconsiderate jerks don’t give a shit when you explain why, they just want it fixed.
Well, here are a few cron job tasks that I came up with to help relieve some of that pressure on your file server.
As a side note, I am extremely curious to know the answer to this hypothetical question: If you were to set the niceness level to 20, would that basically halt or pause the backup job from running during those hours since it would allow 0 CPU usage but not cause the job to fail altogether? If so, I could see some cases where that would be highly beneficial to some and it is definitely worth some investigation.
This magnificent piece of sorcery will achieve the following:
- It limits Backup Exec and any of it’s child processes’ CPU usage during business hours and puts them back to normal priority on off hours.
- It lowers Backup Exec and any of it’s child processes’ disk I/O priority during business hours and puts them back to normal priority on off hours.
- In this particular case, business hours are considered to be Monday through Friday, 6am to 5:59pm. Non business hours are Monday through Friday, 6pm to 5:59am the next day during the week, and all of Saturday and Sunday.
- On business days during the week, the script runs every 15 minutes to be sure that any child processes that may spawn throughout the day get their priorities adjusted.
This will throttle Backup Exec’s CPU and I/O usage to the lowest priority during business hours:
*/15 6-17 * * 1-5 $( for pid in $( pgrep beremote ); do for child in $( ls /proc/$pid/task ); do /usr/bin/renice -n 19 -p $child; /usr/bin/ionice -p $child -c 3; done; done; ) > /dev/null 2&>1
This will return Backup Exec’s CPU and I/O usage to the normal priority during non business hours:
0 18 * * 1-5 $( for pid in $( pgrep beremote ); do for child in $( ls /proc/$pid/task ); do /usr/bin/renice -n 0 -p $child; /usr/bin/ionice -p $child -c 2 -n 4; done; done; ) > /dev/null 2&>1
If you truly want to throttle a process by specifying it’s upper level of bandwidth throughput, you should search online for cgroup’s in Linux.