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

Reply via email to