15

To avoid rsync to starve the system and network we use ionice when starting rsync and set the --bwlimit parameter. For example:

ionice -c2 -n7 rsync -aH --bwlimit=30000 /foo root@dest.com:/

This does indeed help to ensure the source server remains responsive. However, the destination server become very slow due to disk io at 100% (as seen by the atop utility).

Is it possible to somehow use ionice at the destination server too? Perhaps via the rsync -e option? I'd prefer not to run the rsync daemon if possible.

Jason Smith
  • 251
  • 2
  • 3

2 Answers2

13

Changing the rsync command or wrapping it in a shell script to include the ionice command/parameters is an option. Also, You can leverage the --rsync-path option, which tells rsync which command to execute on the remote server. Something like --rsync-path="ionice -c2 -n7 rsync" will ensure that ionice runs on the destination.

I'll add that ionice is not always effective, depending on the server configuration. It only works with the default CFQ I/O elevator. If you've done any storage system tuning, this approach may not be applicable.

Can you give an example of the load or help explain how started the systems become for resources during the copy? I would tend to delve deeper and see why an rsync, especially limited to the low rate you listed in your example, would cause so much trouble.

What are you copying? What is the hardware/OS setup?

ewwhite
  • 194,921
  • 91
  • 434
  • 799
  • We have several OpenVZ hosts. These are 16-core Xeon machines running CentOS. Each night we copy all OpenVZ containers to another hosts. Since our IP addresses are routeable to all hosts, this allows us to quickly activate a backup VPS in case a host fails. – Jason Smith Apr 20 '12 at 13:40
  • How high does the load get? Are these local-to-local copies? Have any changes been made to the storage I/O elevators? – ewwhite Apr 20 '12 at 13:42
  • From what I have seen, limiting network bandwidth does not limit disk io (thousands of directories need to be scanned, even if no files have changed). Should --bwlimit also limit disk i/o? – Jason Smith Apr 20 '12 at 13:46
  • According to `atop` the disk io is constantly bursting to 100%. I am not sure what you mean by "storage I/O elevators", so I probably run the defaults? – Jason Smith Apr 20 '12 at 13:48
2

Your rsync command launches rsync command at the remote destination, too.

Try to put the following to your destination server root user .bashrc, in other words to to /root/.bashrc

alias rsync="ionice -c2 -n7 rsync"
Janne Pikkarainen
  • 31,454
  • 4
  • 56
  • 78
  • A `~/.bashrc` is only sourced for interactive sessions and I don't expect that setting an alias there will modify how rsync gets executed. – HBruijn Oct 11 '16 at 11:42