Load Balancing Algorithms in VCL

Theo Schlossnagle jesus at omniti.com
Tue Mar 4 14:34:42 CET 2008


On Mar 4, 2008, at 6:34 AM, Poul-Henning Kamp wrote:

> In message <47BB56F8.4080902 at gmail.com>, Shiraz Kanga writes:
>>
>> Will it be possible to implement custom Load Balancing algorithms in
>> VCL? There are numerous algorithms that can be used to distribute  
>> load like
>> Round Robin, Weighted Round Robin, Least Connections, Fastest  
>> Response,
>> Most Bandwidth, etc.
>
> The plan is to implement such "directors" in C (we already have  
> "random")
> and I'm not convinced that doing it in VCL makes much sense, but can
> be persuaded otherwise by good arguments.


Load balancing algorithms can be complicated over larger sets of  
backends (if that is the desired use case).  mod_backhand was written  
specifically as a platform to test different algorithms in the lab.   
What I learned from that is that if you have a good (and very simple)  
API to implement new algorithms, then it is easy enough to test.  For  
example, we found interesting and successful approaches using cost- 
benefit-based algorithms and randomized-log2-window algorithms (much  
better than simple random).  As a note, simple random performs really  
well in the lab (better than least-connections and fastest-response)  
and in practice, while it doesn't do as well, it still does better  
than most alternatives -- so good first algorithm selection.

On the other hand, VCL compiles to C.  It seems you have an excellent  
platform to expose that algorithm composition up the stack and make it  
even more accessible without compromising efficiency.  At the end of  
the day, it would only be a convenience thing.  If not in VCL, I hope  
that it could be at least dlopened, so algorithms can be tested post- 
install.

Best regards,

Theo

--
Theo Schlossnagle
Esoteric Curio -- http://lethargy.org/
OmniTI Computer Consulting, Inc. -- http://omniti.com/




More information about the varnish-dev mailing list