Hi,

In our architecture, we have thousands of host names resolving to a single
haproxy, we dynamically decide a sticky backend based on our own custom
sharding. To determine the shard info, we let the request flow in to a
default apache proxy  that processes  the requests and also responds with
the shard info. To be able to serve the consequent requests directly
bypassing the apache, we want to store the shard info received in the first
request in a map and use it for subsequent request

1. Store the shard info from apache
backend apache_l1
        mode http
        http-response set-map(/opt/haproxy/current/conf/proxy.map)
%[res.hdr(X-Request-Host)]  %[res.hdr(X-Backend-Id)]
        server apache_l1 <IP>:80

2. Use the backend directly for subsequent requests:
acl is_a_v-1 hdr(host),map(/opt/haproxy/current/conf/proxy.map) a_v-1
use_backend l2_haproxy if is_a_v-1

I have tested this config and it works well, but I am not sure about the
performance. For every request sent to Apache, we will be adding a key,
value to the map and we will be looking up the key value for every requests
that is coming in to haproxy ­ is that ok considering that this is very high
performance stack? The haproxy servers are pretty powerful and dedicated to
just doing proxy.

Thanks
Sachin


Reply via email to