Re: balance hdr(User-Agent)

From: Willy Tarreau <w#1wt.eu>
Date: Thu, 8 Apr 2010 23:21:46 +0200


On Thu, Apr 08, 2010 at 02:17:31PM -0700, Brian Koloszyc wrote:
> Hi,
>
> I'm wondering if it is possible to load balance using the User-Agent
> string with the "balance hdr(User-Agent)" option?

yes but I'm not sure it's of any use. Hash-based balance algorithms are efficient when the population is very large and well distributed. Here you'll mainly have 4-5 different user agents, some of which may land on the same server, so the balancing could be very poor.

> For example, ideally I would like to have haproxy inspect the User-Agent
> header string, and if the User-Agent = x then send traffic to server A,
> else send traffic to server B.

OK so it's different. The first solution above might work by pure luck. Here if you know that one specific user agent should be sent to one specific server, use two backends with an ACL to decide which one to use depending on the header.

Regards,
Willy Received on 2010/04/08 23:21

This archive was generated by hypermail 2.2.0 : 2010/04/08 23:30 CEST