rsync slow with large number of files, how can I improve it?
October 12, 2013
I have a huge amount of files I am transferring using rsync. I use it as a backup to transfer from my primary system to an NFS file system that is mounted. This is a great solution, however, it is very slow. It takes hours to complete it seems (I never timed it).
Here is my rsync call:
These are user profile pictures and since I have well over 100,000 users, I have a lot of profile pictures to transfer. They all reside in a single directly. These files are around 1-15kb.
What can I do to speed this up?
Here is my rsync call:
rsync -zvr --delete /var/www/site/public_html/pics/ /mount/backup/pics/
These are user profile pictures and since I have well over 100,000 users, I have a lot of profile pictures to transfer. They all reside in a single directly. These files are around 1-15kb.
What can I do to speed this up?
Comments 1
October 12, 2013
rsync is slow and takes a lot of CPU/Memory. If you have a ton of files in a directory, it is probably hanging at the stat() stage. rsync will also make multiple passes per file. Instead of using rsync, you could try tar.
It should operate with much less resource usage although it may still take a bit on a large amount of files.
You can also explode it to where you want to save it:
rsync is slow and takes a lot of CPU/Memory. If you have a ton of files in a directory, it is probably hanging at the stat() stage. rsync will also make multiple passes per file. Instead of using rsync, you could try tar.
[code]?tar -cf foo.tar /var/www/site/public_html/pics/[/code]
It should operate with much less resource usage although it may still take a bit on a large amount of files.
You can also explode it to where you want to save it:
[code]?tar -cf foo.tar /var/www/clerks/public_html/pics/ | tar -x foo.tar /mount/backup/pics[/code]
tar -cf foo.tar /var/www/site/public_html/pics/
It should operate with much less resource usage although it may still take a bit on a large amount of files.
You can also explode it to where you want to save it:
tar -cf foo.tar /var/www/clerks/public_html/pics/ | tar -x foo.tar /mount/backup/pics
Please login or sign up to leave a commentJoin
