On Thu, 31 Mar 2016 08:36:45 +0000
Gerd Mueller <[email protected]> wrote:

> Hi all,
> 
> just read in the documentation that map_str uses a balanced tree vs.
> map_dom is using a list. So why should I use map_dom?


Hi,

from the documentation:

   domain match : check that a dot-delimited portion of the contents
                  exactly match one of the provided string patterns.

The string match does not check the dot delimiters.

If you're matching the host header, in most cases, we known the full
domain. If you write:

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

The domain contained in the host header may be an exact match of the
domain names in your file. For, if your file contains

   google.com

If the host header provides "www.google.com", it not match.
If the host header provides "google.com", it matchs.


> Right now I am
> using following:
> 
> use_backend
> %[req.hdr(host),lower,map_dom(/etc/haproxy/hostname2backend.map,default
> _backend)] 
> 
> Would map_str improve the performance?


it depends of the number of entries of your file
"hostname2backend.map". Approximatively, between 0 and 50 entries, a
list is quick than a tree. For more than 50 line, a tree is faster.
(50 is not the exact limit, but it is a rough estimation).

Thierry

Reply via email to