Hi Thomas,

On Mon, Mar 31, 2014 at 12:29:25PM +0200, Thomas Heil wrote:
> Hi,
> 
> On 31.03.2014 10:45, Willy Tarreau wrote:
> > On Thu, Mar 27, 2014 at 08:57:09PM -0400, Rajat Chopra wrote:
> >> Hi!
> >>    This solution very much solves the problem that I have been facing i.e. 
> >> large number of acl rules causing latency in requests. Been in discussions 
> >> separately about it and today I got a chance to test out this patch. I 
> >> report that it works great! I have been able to route 150k backends with 
> >> this and the latency added because of the dynamic lookup is in order of 
> >> microseconds (compared to 24ms earlier).
> >>
> >>
> >> The usage 'use_backend bk_%[hdr(Host)] if TRUE' works for my use-case but 
> >> originally I was wondering if one could do a map based lookup for the 
> >> backend.
> >> As posted here :
> >> http://stackoverflow.com/questions/22025412/how-to-use-thousands-of-backends-in-haproxy-is-the-new-map-feature-useful-for-t
> >>
> >> Most of the issues in the above question are now solved, but I tested this 
> >> with the patch ->
> >> use_backend bk_%[hdr(Host), map(host_to_backend_map.file)] if TRUE
> >>
> >> And it does not work. I am not yet familiar with code to determine why 
> >> this does not work. Again, the current proposal works well for me but an 
> >> enhancement should probably consider using maps within dynamic lookup.
> >>
> >> +1 for the patch.
> > OK so in the absence of any other comment, I just merged it.
> Could you add an example of such an /etc/haproxy/static/proxy.pac.cust1
> file?

The maps are very simple, the first column is the pattern (just like in ACL
files) and the second column is the output sample, hence the pattern used
to build the backend name here.

So if you want "host: foo" to match "bk_bar" with the config above, you'll
simply need a line like this in your map file :

    foo bar

Regards,
Willy


Reply via email to