Re: Sticking to a particular server for testing...

From: Willy Tarreau <>
Date: Thu, 3 Jul 2008 18:20:24 +0200

On Thu, Jul 03, 2008 at 12:57:10AM -0600, Unai Rodriguez wrote:
> One other thing, it is related, it was asked recently but I did not fully
> understand the answer... If HAProxy is performing load balancing based on
> source IP, what has precedence, the source ip or the cookie?
> Let's say, according to the source ip balancing a client should go to
> server#3 but he has a cookie pointing to server#1. Where is he going?

As I explained in another recent mail on the subject, persistence always has precedence over load balancing. The load balancing algorithm is involved only when there is no persistence information. So if your cookie points to server#1, you will go to server#1 (unless it is down).

It is very important to understand this, as this is the base of any architecture you might want to build. Some people use "balance source" with cookies enabled in order to ensure that clients who ignore cookies will stick to the same server (from their IP) and that clients who have a constantly changing IP address stick to the same server (from their cookie).

Hoping this clarifies the issue,
Willy Received on 2008/07/03 18:20

This archive was generated by hypermail 2.2.0 : 2008/07/03 18:30 CEST