Improve RSYNC scan speed / Alternate approach?
I'm using rsync to transfer application log files from one server to another. It works fine with the exception that scanning the directories takes forever. I have around 160,000 log files and a few thousand directories so I can understand why scanning takes so long. However, only a few of those files changes at any given sync so I'm wondering if there's a more efficient way or rsync option that may speed this up? The log files themselves are tiny (only a few kb each).
Thank you!
From the manpage:
Beginning with rsync 3.0.0, the recursive algorithm used is now an incremental scan that uses much less memory than before and begins the transfer after the scanning of the first few directories have been completed. This incremental scan only affects our recursion algorithm, and does not change a non-recursive transfer. It is also only possible when both ends of the transfer are at least version 3.0.0.
Some options require rsync to know the full file list, so these options disable the incremental recursion mode. These include:
--delete-before
,--delete-after
,--prune-empty-dirs
, and--delay-updates
. Because of this, the default delete mode when you specify --delete is now--delete-during
when both ends of the connection are at least 3.0.0 (use--del
or--delete-during
to request this improved deletion mode explicitly). See also the--delete-delay
option that is a better choice than using--delete-after
.
If you're using any of those mentioned options or older versions of rsync you may be disabling the improved incremental recursion mode. Otherwise the only other option is to give rsync fewer files to consider.