GNU parallel with rsync
Are you sure the rsyncs are really not running in parallel ?
Checking with ps | grep rsync
while the command is running will show which and how many rsyncs are actually running simultaneously.
By default, parallel
holds printing output from each job until it's finished so that the different commands' output don't get all mixed up together:
--group Group output. Output from each jobs is grouped together and is only printed when the command is finished. stderr (standard error) first followed by stdout (standard output). This takes some CPU time. In rare situations GNU parallel takes up lots of CPU time and if it is acceptable that the outputs from different commands are mixed together, then disabling grouping with -u can speedup GNU parallel by a factor of 10. --group is the default. Can be reversed with -u.
My guess is the rsyncs are actually running in parallel, but from the output it feels like they're running serial. -u
option changes that.
--
For example with this cmd:
$ for i in 1 2 3 ; do echo a$i ; sleep 1 ; donea1a2a3
By default in parallel we get no feedback until it's all done:
$ (echo a ; echo b ; echo c ) | parallel 'for i in 1 2 3 ; do echo {}$i ; sleep 1 ; done ' a1a2a3b1b2b3c1c2c3
Whereas with -u
stuff get printed right away:
$ (echo a ; echo b ; echo c ) | parallel -u 'for i in 1 2 3 ; do echo {}$i ; sleep 1 ; done ' a1b1c1a2b2c2a3b3c3
In both cases it took 3s to run though so it's really running simultaneously...