I was just playing around with the configuration from the excellent
blog entry on e-commerce overload protection:
http://blog.haproxy.com/2012/09/19/application-delivery-controller-and-ecommerce-websites/

If you have a PHPSession or ASPsessionID cookie then you can track the
total number of users as follows:

listen L7-Test
bind 192.168.64.27:80 transparent
mode http
acl maxcapacity table_cnt ge 5000
acl knownuser hdr_sub(cookie) MYCOOK
http-request deny if maxcapacity !knownuser

stick-table type string len 32 size 10K expire 10m nopurge
stick store-response set-cookie(MYCOOK)
stick store-request cookie(MYCOOK)


balance leastconn
cookie SERVERID insert nocache
server backup 127.0.0.1:9081 backup non-stick
option http-keep-alive
option forwardfor
option redispatch
option abortonclose
maxconn 40000
server Test1 192.168.64.12:80 weight 100 cookie Test1
server Test2 192.168.64.13:80 weight 100 cookie Test2

But what if you only have a single source IP (so you still want to use
cookies to track the usage AND stickyness) but the application doesn't
have its own unique session id?

Can you do something like using gpc0 to store a random haproxy session
id (for overload) and yet still using cookie SERVERID for the
persistence?
Or using a big IP stick table even though all the IPs will be the same?

Or am I just being really stupid today , which is not unusual :-).

Thanks in advance.


-- 
Regards,

Malcolm Turnbull.

Loadbalancer.org Ltd.
Phone: +44 (0)330 1604540
http://www.loadbalancer.org/

Reply via email to