V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
kkfnui
V2EX  ›  分享发现

rsync jar 包可以增量同步

  •  
  •   kkfnui · 2018-03-30 18:15:22 +08:00 · 2960 次点击
    这是一个创建于 2217 天前的主题,其中的信息可能已经有所发展或是发生改变。

    用 maven 重新编译工程,让后用 rsync 将 jar 同步到线上的服务器是,发现速度异常的快。

    做了下列测试:

    • 将服务器 jar 包删除,同步速度会慢很多
    • 本地删除 jar 重新编译,rsync 显示发送字节数 300 多 KB

    猜测,rsync 针对 jar 这种压缩文件的传输做了优化,仅仅会同步 jar 包中有更新的文件。

    4 条回复    2018-03-31 10:24:51 +08:00
    oott123
        1
    oott123  
       2018-03-30 18:42:35 +08:00   ❤️ 1
    是的,rsync 的手册上写道:

    rsync is a program that behaves in much the same way that rcp does, but
    has many more options and uses the rsync remote-update protocol to
    greatly speed up file transfers when the destination file is being
    updated.

    The rsync remote-update protocol allows rsync to transfer just the dif-
    ferences between two sets of files across the network connection, using
    an efficient checksum-search algorithm described in the technical
    report that accompanies this package.

    参考: https://rsync.samba.org/tech_report/tech_report.html
    oott123
        2
    oott123  
       2018-03-30 18:44:22 +08:00   ❤️ 1
    事实上,rsync 对任何只变化了一小部分的文件同步都是十分效率的。
    julyclyde
        3
    julyclyde  
       2018-03-30 21:22:23 +08:00
    没有说明发送方向,只说“将服务器上 jar 删除”、“将本地 jar 删除”
    简直是自言自语
    kkfnui
        4
    kkfnui  
    OP
       2018-03-31 10:24:51 +08:00
    @julyclyde 有说明:

    用 rsync 将 jar 同步到线上的服务器

    第一句就是。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3486 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 11:00 · PVG 19:00 · LAX 04:00 · JFK 07:00
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.