Bandwidth Hogging
Popular copying and downloading commands such as wget
and rsync
are wonderful tools.
Except they can be bandwidth hogs.
Fortunately these commands have options to limit bandwidth usage and reduce network congestion.
ISP speed tests are run hourly in the house network. With slow fixed wireless speeds every megabit counts. Monitoring the connection and maintaining logs to create pretty graphs is important, otherwise convincing the ISP owners of issues can be Sisyphean.
The rsync command is used in several shell scripts in the house network. Two of those scripts maintain local Slackware repositories. Downloading updates with rsync hinders those hourly speed tests.
The respective scripts are automated through cron jobs. While striving to avoid conflicts in cron jobs, sometimes there is some overlap. In this particular case the result is a bandwidth fight “red in tooth and claw.” The rsync command is ruthless. To have reliable and consistent logs the speed tests must be given preference.
Some tests in the rsync scripts help. One test terminates the script when an active speed test process is detected. A message is printed on screen when run interactively or otherwise reschedules the script in two minutes with the at
scheduler.
If a VPN client is detected, which on an already low speed connection means even slower speeds, then the scripts limit the rsync bandwidth (--bwlimit
) to about half the rated download speed of the ISP package. That helps not slam the speed test results into oblivion.
A related test is the rsync bandwidth option is triggered if the current time is within 15 minutes of the next scheduled speed test cron job.
Another trick is within the speed test script. When the script finds specific active rsync processes the speed test script pauses those processes with kill SIGSTOP
. After completing the speed test the script resumes the processes with kill SIGCONT
.
Speed test results are more palatable when concurrently running bandwidth hog commands. Yet this feels a bit like Red Green using duct tape. Probably a more robust solution to tame this fight should be through network traffic control.
Posted: Usability Tagged: General
Category:Next: A Simple Intrusion Detection Trick
Previous: Slackware Minimal Install