Hey guys,
We've been happy users of haproxy in front of our tomcat farm for some
time now, except for one thing: when we want to put a backend in
maintenance mode, via hatop, we have to deal with users coming back a
few hours later with a SERVERID cookie and being routed to that backend.
I initially configured haproxy to balance based on a SERVERID cookie,
essentially because I didn't know if the JSESSIONID would provide the
appropriate persistence, but now I'm thinking that it might be a good
idea to remove the SERVERID cookie and do all the work on the
JSESSIONID. The goal would be to reduce the time between putting a
server in maintenance and not seeing any traffic on it at all (ie. all
sessions are expired).
So my question is: what are the pros and cons of using a SERVERID
cookie vs a JSESSIONID ?
Thanks,
Julien
-------------------------------
global
maxconn 10000
log localhost:514 local0
daemon
user haproxy
group haproxy
pidfile /opt/haproxy/var/haproxy.pid
stats socket /opt/haproxy/var/haproxy.sock level admin
defaults
log global
option dontlognull
retries 3
option redispatch
option tcp-smart-accept
timeout connect 30s
timeout client 30s
timeout server 30s
timeout check 30s
errorfile 500 /opt/haproxy/etc/errors/berightback500.http
errorfile 502 /opt/haproxy/etc/errors/berightback502.http
errorfile 503 /opt/haproxy/etc/errors/berightback503.http
errorfile 504 /opt/haproxy/etc/errors/berightback504.http
frontend http-in
bind *:51080
mode http
option httplog
option httpclose
default_backend alp-app
capture request header Host len 100
capture request header X-Forwarded-For len 50
capture cookie JSESSIONID len 60
capture response header x-lighttpd-uid len 300
acl alp-control path_beg -i /control
use_backend alp-control if alp-control
backend alp-app
mode http
appsession JSESSIONID len 60 timeout 1h request-learn mode
path-parameters
balance roundrobin
#cookie SERVERID insert indirect maxidle 3h maxlife 12h
# http healthcheck
option httpchk GET /viewer/home.htm HTTP/1.1\r\nHost:\
www.webserver.com
server qa-app1 10.1.2.20:9080 cookie qalp-app1 maxconn 256 maxqueue
5000 weight 50 check inter 2s
server qa-app2 10.1.2.21:9080 cookie qalp-app2 maxconn 256 maxqueue
5000 weight 50 check inter 2s
backend alp-control
mode http
balance roundrobin
#cookie SERVERID insert indirect maxidle 3h maxlife 12h
option httpchk GET /viewer/home.htm HTTP/1.1\r\nHost:\
www.webserver.com
server qa-app1 10.1.2.20:9080 cookie qalp-app1 maxconn 256 maxqueue
5000 weight 50 check inter 2s