0

In first I will try to describe the problem. We use following network configuration:

  • machine1 with installed haproxy
  • machine2 with application(in this case we can assume that is only RabbitMq service)
  • machine3 as test server(copy of machine2)

All traffic goes to port(777 for example) of machine1. Haproxy redirect traffic to port(888 for example) of machine2. Application on machine2 listen port 888 and process requests. Also we have machine3 as test server and when we prepare next release we want to test it with real load.

So question now: is posible to duplicate incoming network traffic from port 777 of machine1 to port 888 of machine2 and(somitemes, when we need that) to port 888 of machine3?

PS Sorry for my bad English

Tero Kilkanen
  • 36,796
  • 3
  • 41
  • 63
Frank59
  • 103
  • 4

2 Answers2

1

The only thing similar to what you are asking is port mirroring on a switch. This would split the traffic, but you cannot have both servers responding to the same packets. Port mirroring is usually used with a listen-only device for reporting or tracking. It would not be able to give you a load test.

Cory Knutson
  • 1,876
  • 13
  • 20
1

If your traffic uses TCP for communication, any Layer 2 traffic duplication won't work. This is because TCP handshake is a bi-directional process, where client needs to send back response packets to the client.

If such traffic duplication is done on a higher level, the issue is responses to clients. If two server's receive the same traffic, and both send responses back, which response should be sent?

You should be able to set traffic processing rules in HAProxy, which divides traffic between servers. This way you can get real traffic to the test server.

However, sending production users to test servers is not a good idea.

The only good solution is to set up proper load-testing using tools designed for it. With the tools, you can set up test scenarios for load testing, and the perform requests like real clients.

Tero Kilkanen
  • 36,796
  • 3
  • 41
  • 63