HAProxy community

Performance on using map with conditional


Hi, a few very basic questions on setting up haproxy using map file.

Currently we have two separate networks, and we use DNS to split the load of half of our sites to one network, and half the other. We originally envisioned creating two separate maps , one for each network. In an emergency, if one network goes down, changing DNS (and haproxy config) to put all sites onto one network.

We originally envisioned created two separate map files and changing the config in situation where failure of one network so that both maps are loaded, like so:

use_backend %[req.hdr(host),lower,map(/etc/haproxy/grp_1a.map,bk_default)]     \
               if { req.hdr(host),lower,map_beg(/etc/haproxy/grp_1a.map) -m found }

use_backend %[req.hdr(host),lower,map(/etc/haproxy/grp_1b.map,bk_default)]     \
               if { req.hdr(host),lower,map_beg(/etc/haproxy/grp_1b.map) -m found }

Is there a performance penalty by using the conditional with the mapping, vs saying merging the two separate files into one? For example:

use_backend %[req.hdr(host),lower,map(/etc/haproxy/grp_1.map,bk_default)]

The reason splitting into two files was so that each haproxy frontend does not have to do heartbeat checks to every backend (roughly half the backends serve for one network, and the other half serve the second.)

If we had 40 backends , using inter 10000, does it really matter significantly if one haproxy checks 20 backends or 40?