Re: Haproxy Dought

From: Alberto Giménez <lagimenez#gmail.com>
Date: Wed, 4 Jun 2008 14:04:19 +0200


On Wed, Jun 4, 2008 at 10:02 AM, Shahid P.A <shahid.azeez#gmail.com> wrote:
> Hai,
>
> I uses haproxy for load balansing one of our site.
> My Load balance congiguration is below:
>
> cookie SERVERID insert nocache indirect
>
> # cookie JSESSIONID prefix

> It is working well But the problem is when I uses "cookie SERVERID insert
> nocache indirect", the client will always connect to the one server.

THAT is the expected behaviour. HTTP is stateless, so a browser will open & close TCP connections between several requests. So the load balancer would redirect a request from a session to the wrong server. Cookie insertion aims to fix this: whenever a new client arrives, he is assigned a FIXED server and he always connects to this one.

> Redispatch occur when the connected server crashes. But when I uses "cookie
> JSESSIONID prefix " load balance will always interchange between the two
> servers.

Does your application insert a JSESSIONID cookie?

> When I logged in to the application using user name and password
> session will live only in one server and when the load balance connect to
> other server I will be automatically logged out.

That's why cookie-based persistency is useful: to connect to the server that has the session information.

>Is there any way for
> storing sessions or cookie on both the servers and I am running memcahe on
> both the servers.

If you want to make a seamless load balancing with session support BUT NOT cookie based, your only chance is to store session information in some kind of shared storage visible by both servers.

Best regards,

-- 
Alberto Giménez
Received on 2008/06/04 14:04

This archive was generated by hypermail 2.2.0 : 2008/06/04 14:16 CEST