Amit Dalal
Amit Dalal

Reputation: 652

configuring load/traffic split using haproxy

I have two app servers which are behind an haproxy load balancer. Is there a configuration available using which I can split the traffic between the two as per my requirement. Like sending x% of the requests to server A and rest to server B.

Upvotes: 0

Views: 923

Answers (1)

dtorgo
dtorgo

Reputation: 2116

You have several options, but I do not think that you can directly do what you want to do. Dividing the traffic close to 50/50 is as easy as setting the load balancing algorithm to "round robin". What it sounds like you want to do is be able to send 15% of traffic to server A and then 85% to server B. In order to do this simply set a cookie on the client (some random number between 1-100 for example) and then send all traffic with a cookie value of less than 16 to server A and the rest to server B.

Upvotes: 1

Related Questions