信息网络安全 ›› 2025, Vol. 25 ›› Issue (3): 425-437.doi: 10.3969/j.issn.1671-1122.2025.03.006

• 理论研究 • 上一篇    下一篇

基于Rsync算法的实时同步模型优化

秦金磊(), 孙珊珊, 李整   

  1. 华北电力大学计算机系,保定 071003
  • 收稿日期:2025-01-10 出版日期:2025-03-10 发布日期:2025-03-26
  • 通讯作者: 秦金磊 E-mail:jlqin717@163.com
  • 作者简介:秦金磊(1979—),男,河南,副教授,博士,主要研究方向为云计算、系统安全|孙珊珊(2001—),女,河北,硕士研究生,主要研究方向为云计算、数据安全|李整(1981—),女,河北,副教授,博士,主要研究方向为智能算法
  • 基金资助:
    中央高校基本科研业务费专项资金(2020MS120);河北省自然科学基金(F2014502081)

Optimization of Real-Time Synchronization Model Based on Rsync Algorithm

QIN Jinlei(), SUN Shanshan, LI Zheng   

  1. Department of Computer, North China Electric Power University, Baoding 071003, China
  • Received:2025-01-10 Online:2025-03-10 Published:2025-03-26
  • Contact: QIN Jinlei E-mail:jlqin717@163.com

摘要:

针对远程同步Rsync算法在运行过程中校验和计算对比开销大、同步过程繁琐的问题,文章提出一种基于SipHash强校验的远程同步算法RSip_sync。首先,在计算强校验时采用SipHash算法,重构校验和计算函数并对其内部进行分割;然后,更新校验和验证逻辑,以适应SipHash内部分割算法,其简单的运算过程和较少的迭代轮次使得校验和计算与对比开销减少;最后,利用Inotify实时监控文件技术,实时监控指定数据备份目录中文件的更新变化,从而实现实时自动同步数据。在两组数据集上的仿真实验结果表明,相较于Rsync算法,RSip_sync计算差异数据的耗时减少了40.28%,整体的数据同步时间减少了4.91%,同步速度提升了8.86%。实验结果验证了RSip_sync算法的有效性,其采用的强校验和更适合远程同步,降低了块比较的复杂度,可以更快地进行数据同步。

关键词: Rsync, SipHash, 实时数据同步, 云文件

Abstract:

To address the problem of high overheads of computation and comparison of checksums and the complexity of synchronization during the executing of the remote synchronous (Rsync) algorithm, a remote synchronous algorithm with SipHash strong check (RSip_sync) was proposed. First, the SipHash algorithm was adopted while the strong check was calculated. Then the checksum calculation function was reconstructed and its internal structure was also segmented. Second, the verification logic of checksum was updated in order to adapt to the SipHash internal segmentation algorithm whose simple operation and fewer iteration rounds reduced the cost of checksum calculation and comparison. Finally, by the Inotify real-time monitoring file technology, the changes of files in the specified backup directory were monitored in real time so that the real-time automatic synchronization of data could be achieved. The simulation results based on two datasets show that, compared with the Rsync algorithm, RSip_Sync reduces the time by 40.28% for calculating differential data, reduces the synchronization time by 4.91% in overall data synchronization, and improves the synchronization speed by 8.86%. The experimental results have verified the effectiveness of the RSip_sync algorithm which uses strong checksum that is more suitable for remote synchronization, reduces the complexity of block comparison, and enables faster data synchronization.

Key words: Rsync, SipHash, real time data synchronization, cloud files

中图分类号: