I want to use haproxy as a proxy and load balancer for thousands of backends. Thus, the request must be proxied to the correct backend depending on the host name, and then balance the load in the backend. I am using haproxy-1.5dev21.
The configuration file is as follows:
frontend public bind :80 mode http acl host1 hdr_reg(host) host1.com use_backend be_host1 if host1 acl host4000 hdr_reg(host) host4000.com use_backend be_host4000 if host4000 backend be_host[n] server hostn_1 server hostn_2
The problem is that I get an additional 30 ms delay per request if there are 5,000 hosts. And for 20k backends, haproxy takes a lot of time to load, not to mention the latency crash for each request.
Can I do something better than consecutive acl rules? I did not find an example for the new map function - the release notes say that it can be used for mass forwarding rules. I tried this:
use_backend %[hdr(host), map(host_to_backend_map.file)]
Something is clearly stupidly higher when using maps, but any guidance would be helpful. Thanks!
reverse-proxy load-balancing haproxy
rcrc
source share