使用代理重复TCP流量 [英] Duplicate TCP traffic with a proxy

查看:227
本文介绍了使用代理重复TCP流量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从一台机器(端口)和两台不同的机器(端口)发送(重复)流量。我还需要照顾TCP会话。

I need to send (duplicate) traffic from one machine (port) and to two different machines (ports). I need to take care of TCP session as well.

在beginnig中,我使用了 em-proxy ,但在我看来,开销相当大(超过cpu的50%)。
然后我安装了 haproxy ,我设法重定向流量(不重复)。开销是合理的(小于5%)。

In the beginnig I used em-proxy, but it seems to me that the overhead is quite large (it goes over 50% of cpu). Then I installed haproxy and I managed to redirect traffic (not to duplicate). The overhead is reasonable (less than 5%).

问题是我在haproxy配置文件中不能说如下:

- listen在具体的地址:端口和任何你发现发送在两个不同的
机器:端口,并丢弃其中一个答案。

The problem is that I could not say in haproxy config file the following:
- listen on specific address:port and whatever you find send on the two different machines:ports and discard the answers from one of them.

Em代理代码这很简单,但在我看来,EventMachine生成
a很多开销。

Em-proxy code for this is quite simple, but it seems to me that EventMachine generates a lot of overhead.

在我挖掘haproxy代码并尝试更改(重复流量)之前,我想要
知道有什么类似的东西吗?

Before I dig in haproxy code and try to change (duplicate traffic) I would like to know is there something similar out there?

谢谢。

推荐答案

我已经为此创建了一个代理。

I have created a proxy just for this purpose.

https://github.com/chrislusf/teeproxy

用法

./teeProxy -l :8888 -a localhost:9000 -b localhost:9001

tee-proxy是一个反向代理。对于每个传入请求,它将请求克隆为2,然后将其转发到2个服务器。服务器 a 的结果照常返回,但服务器 b 的结果将被忽略。

tee-proxy is a reverse proxy. For each incoming request, it clones the request into 2 and then forwards them to 2 servers. The results from server a is returned as usual, but the results from server b is ignored.

tee-proxy处理 GET POST 和其他HTTP方法。

tee-proxy handles both GET, POST, and other HTTP methods.

这篇关于使用代理重复TCP流量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆