Re: Persistence + Round Robin

From: Willy Tarreau <>
Date: Sun, 28 Sep 2008 08:49:07 +0200


On Wed, Sep 24, 2008 at 11:23:07PM -0500, Brian Moschel wrote:
> We're building a comet application with persistent connections, which is why
> it needs persistence after the first time. It runs on multiple nodes with
> shared memory (Terracotta), but the performance is much better when users
> from the same referer are grouped together, hence the need to send 100 users
> from each referer to each node.

Hmmm... why not simply hash on the Referer header then ? Maybe we should even strip it to keep only the domain name before hashing it.

If you fear having too many connections one one server and too few on another one, we could implement a variable hash. We could add a key which will be changed every X requests. That way, if 90% of your users come from the same referer, a first chunk will go to the first server, then the hashing key will change and next chunk will go to another server. The 10% remaining users will also be redispatched, but that should not be a problem. An alternative method would consist in using the time in the hashing key, but that would be less smooth I think.

Anyway, what I primarily identify in your request is the need to hash on part of a header. I think we should quickly implement header hashing based on a regex, so that anyone could hash on a randomly picked criterion in the request.

Willy Received on 2008/09/28 08:49

This archive was generated by hypermail 2.2.0 : 2008/09/28 09:02 CEST