I added "option http-server-close" to all backends (both the hdr(Host) 
balanced one, and the roundrobin one), and the behavior is the same.

Stats output showing the table contents is:

echo 'show table ft_web' | socat /var/run/haproxy.sock stdio

# table: ft_web, type: string, size:1024000, used:1
0x2547540: key=a.com use=0 exp=244775 server_id=2 http_req_rate(10000)=0

Is there a way to unset the server_id? Or is that a required key for the 
table entry? I know the doc notes that field is enabled by default.

Thanks!
— Dan.




On 11/24/14, 10:35 PM, "Baptiste" <[email protected]> wrote:

>On Mon, Nov 24, 2014 at 11:08 PM, Daniel Dubovik <[email protected]> 
>wrote:
>> Hey all!
>>
>> We have a cluster of HAProxy servers, in front of a set of Varnish 
>>nodes.
>> Currently, we have HAProxy set to load balance traffic based on Host
>> header to a given varnish server.  Some of our sites have enough 
>>traffic,
>> that it warrants roundrobining their traffic to multiple varnish 
>>servers.
>>
>> I've been looking into using stick-tables for connection tracking, and
>> seem to have run into a wall, so hoping someone where can help.
>>
>> Relavent config follows:
>>
>> ---------------------------------------------------------
>> frontend ft_web
>>   option forwardfor
>>   stats enable
>>   stats scope .
>>   bind :80
>>
>>   #Setup our stick-table and connection rate tracking
>>   stick-table type string len 50 size 1000k expire 5m peers 
>>loadbalancers
>> store http_req_rate(10s)
>>   tcp-request inspect-delay 5s
>>   tcp-request content track-sc1 hdr(Host)
>>
>>
>>   acl heavy_hitters sc1_http_req_rate gt 5
>>
>>
>>   # Heavy site only
>>   use_backend varnish_heavy if heavy_hitters
>>
>>   # Just a standard http request, with no special options
>>   default_backend varnish
>>
>> backend varnish_heavy
>>   stats enable
>>   stats scope .
>>   balance roundrobin           # Balance based on requested host
>>
>>   # Add connection tracking
>>   #    stick on hdr(Host) table ft_web
>>   stick store-request hdr(Host) table ft_web
>>
>>
>>   http-response set-header X-HEAVYSITE 1
>>
>>   server varnishserver01 10.11.12.13:80 weight 1 track
>> check_servers/varnishserver01-track
>>   server varnishserver02 10.11.12.14:80 weight 1 track
>> check_servers/varnishserver02-track
>>
>>
>>
>> backend varnish
>>   stats enable
>>   stats scope .
>>   balance hdr(Host)           # Balance based on requested host
>>   hash-type consistent djb2
>>
>>   # Add connection tracking
>>   #    stick on hdr(Host) table ft_web
>>   stick store-request hdr(Host) table ft_web
>>
>>   server varnishserver01 10.11.12.13:80 weight 1 track
>> check_servers/varnishserver01-track
>>   server varnishserver02 10.11.12.14:80 weight 1 track
>> check_servers/varnishserver02-track
>>
>>
>> ----------------------------------------
>>
>>
>>
>> Note:  I tried both "stick on" and stick store-request, and both had the
>> same behavior
>>
>> What I've found is, the backend selection will work.  We will trigger 
>>the
>> rate limit, and I will see the X-HEAVYSITE header, so I know that part 
>>is
>> working.  The trouble is, the balance algorithm is being ignored, and we
>> are pinning sites to the same server still.  Is there a way for me to 
>>have
>> it honor the balance algorithm (roundrobin in this case) for requests 
>>in a
>> stick-table, and not use the server_id value to auto-determine the 
>>server
>> to use?
>>
>> Thanks!
>> Dan Dubovik
>> Senior Linux Systems Engineer
>> 480-505-8800 x4257
>>
>
>
>Hi daniel
>
>Can you give a try to "option http-server-close" in your roundrobin 
>backend?
>
>Baptiste





Reply via email to