Hi,

I've posted a question on Server Fault but as no one has answered I was
hoping I might be able to get help here.
http://serverfault.com/questions/495049/using-url-parameters-for-load-balancing-with-haproxy

I have a system which is load balancing via a cookie, but I want to use a
URL parameter as an alternative. (Specifically, I have a front end app
which does not support cookies). My setup is a little complex - I have a
multiplayer system and I use a stick table with this cookie to make sure
different people playing the same game go to the same server. This works
great, except that the URL parameters don't seem to do anything. This is
all with haproxy 1.5dev17

My relevant backend is:

defaults
   log            global
   mode           http
   option         httplog
   option         dontlognull
   retries        3
   option         redispatch
   option         http-server-close

   maxconn        2000
   contimeout     5000
   clitimeout     50000
   srvtimeout     50000

backend simulate
    option httpchk OPTIONS /simulate/api/status
    stick-table type string len 40 size 5M expire 30m
    stick store-response set-cookie(SIMULATE_STICKY_SESSION) table simulate
    stick on cookie(SIMULATE_STICKY_SESSION) table simulate
    stick on url_param(SIMULATE_STICKY_SESSION) table simulate

    server app1 10.0.2.11:8080  cookie app1 check inter 10000
    server app2 10.0.3.11:8080  cookie app2 check inter 10000

    Note that SIMULATE_STICKY_SESSION is generated by my app (based on
player team).

When I call the URL, I need to pass a jsessionid (so that Tomcat will find
the correct session). So I am doing

http://my.domain.com/myapp/url;SIMULATE_STICKY_SESSION=1918C909D3F30DB09C2F96B75C57D015.app1+jsessionid;jsessionid=1918C909D3F30DB09C2F96B75C57D015.app1

This doesn't seem to be picking up the sticky session parameter as 50% of
the time it goes to the wrong server. I tried using the param as a query
string (after a ? mark) but that didn't work either. What am I doing wrong?


Thanks in advance, WILL

Reply via email to