在进行灰度又或者进行压测(或者放大倍率)的时候,我们可能会选择流量拷贝的方案来佐证我们架构设计的可行性和可用性,关于流量拷贝这块,可能大家听到的额最多的是老牌工具tcpcopy, 除此之外还有goreplay, sharingan,下面我们挨个简单介绍下(只是介绍),具体的使用还是要参考官方文档。
•tcpcopy•goreplay•sharingan
An online request replication tool, also a tcp stream replay tool, fit for real testing, performance testing, stability testing, stress testing, load testing, smoke testing, etc
支持实时数据流复制,同时也支持TCP流量复制,适用于性能测试,压力测试,冒烟测试场景的开源工具。
tcpcopy[1]
•3.6k star•基于c语言
GoReplay is an open-source tool for capturing and replaying live HTTP traffic into a test environment in order to continuously test your system with real data. It can be used to increase confidence in code deployments, configuration changes and infrastructure changes.
GoReplay是一个开源工具,用于捕获实时HTTP流量并将其重放到测试环境中,以便使用真实数据持续测试系统。
GoReplay不是代理,而是监听网络接口上的流量,不需要更改生产基础架构,而是在与服务相同的计算机上运行GoReplay守护程序。
goreplay[2]
•12.9k star•基于Go语言
Sharingan(写轮眼)是一个基于golang的流量录制回放工具,适合项目重构、回归测试等。
sharingan[3]
•滴滴出品•212 star•基于Go语言
Diffy + Goreplay使用[4]
Test Your APIs on Actual traffic with GoReplay[5]
在大的feature更新或者重构的的时候,如果我们没有十足的把握直接上到生产,这个时候上面列的工具就可以派上用场了,进行灰度 + 扩大倍率的压测就能做到心中有底,我们使用过goreplay, 选择他的原因是tcpcopy稍微有点重,至于sharingan的话,暂时还没有用过,因为刚出来没多久,不过看其官方文档描述,是比goreplay在下游实现方案更优雅,有机会可以玩一玩。
[1]
tcpcopy: https://github.com/session-replay-tools/tcpcopy
[2]
goreplay: https://github.com/buger/goreplay
[3]
sharingan: https://github.com/didi/sharingan
[4]
Diffy + Goreplay使用: http://xifxiong.online/goreplay/
[5]
Test Your APIs on Actual traffic with GoReplay: https://medium.com/@reshadat/test-your-apis-on-actual-traffic-with-goreplay-88810fbe6d1d