Analysis of rsync synchronization speed using linux commands
Rsync is a data image backup tool in unix-like systems-remote sync. A Fast Incremental Backup Tool, Remote Sync, supports local replication or synchronization with other SSH and rsync hosts.
Its features are as follows:
1) images can be used to save the entire directory tree and file system.
2) It is easy to maintain the permissions, time, and soft and hard links of the original file.
3) installation without special permissions.
4) fast: During the first synchronization, rsync copies all the content, but transfers only modified files the next time. Rsync can compress and decompress data during data transmission, so it can use less bandwidth.
5) Security: You can use scp, ssh, and other methods to transmit files. Of course, you can also use a direct socket connection.
6) anonymous transmission is supported to facilitate website images.
Here is my rsync script, which basically meets most of the requirements:
rsync --compress --recursive --times --perms --owner --group --links --exclude=smarty/templates_c/ --timeout=30 [path] [user]@[ip]:[path]echo '----------------------------------------------------'echo "complete rsync [path] to [user]@[ip]:[path]"
Parameter Parsing:
-Z, -- compress compresses backup files during transmission
-R, -- recursive processes subdirectories in recursive Mode
-T, -- times preserve the file time information
-P, -- perms to keep File Permissions
-O, -- owner keeps file owner information
-G, -- group: Keep file group information
-L, -- links retains soft links
-- Exclude = PATTERN specifies to exclude file modes that do not need to be transmitted
-- Timeout = time ip timeout, in seconds
Rsync speed test
The synchronization directory size is 88 MB. Run the following command:
building file list ... donesent 637987 bytes received 20 bytes 425338.00 bytes/sectotal size is 88738094 speedup is 139.09
We can see that only KB of data is transmitted, rather than the actual 88M data, because rsync does not synchronize all files.