Thanks for all the pointers in this thread...  for now I've been pulled to work on something else but I'll be back in the coming weeks.<br><br>A few people mentioned Apache, the reason I don't do this with Apache is I want reloading of the configuration to be simple,  it seems Varnish reloads are quick and easy.<br>
<br>I'll experiment with Varnish inline C  next and research some of the other proxies mentioned.<br><br>Thanks for the pointers..  I'll be back.  ;-)<br><br>Tony<br><br><div class="gmail_quote">On Thu, Aug 5, 2010 at 10:14 PM, Michael Alger <span dir="ltr"><<a href="mailto:varnish@mm.quex.org">varnish@mm.quex.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">On Thu, Aug 05, 2010 at 12:21:07PM -0400, Tony Primerano wrote:<br>
> On Thu, Aug 5, 2010 at 10:50 AM, Per Buer <<a href="mailto:perbu@varnish-software.com">perbu@varnish-software.com</a>>wrote:<br>
><br>
> > On Thu, Aug 5, 2010 at 4:33 PM, Tony Primerano <<a href="mailto:tony.primerano@gmail.com">tony.primerano@gmail.com</a>><br>
> > wrote:<br>
> ><br>
> > > But what if I have 1000s of backends and I choose them based on<br>
> > > the domain that user's hit varnish with.   Is this something<br>
> > > Varnish handles or is it only intended to work with a handful of<br>
> > > backends?<br>
> ><br>
> > It's not built for that.  Kristians dns director might help you out<br>
> > a bit, but it just entered trunk (will be in 2.1.4).<br>
><br>
> <a href="http://kristianlyng.wordpress.com/2010/08/02/varnish-backend-selection-through-dns/" target="_blank">http://kristianlyng.wordpress.com/2010/08/02/varnish-backend-selection-through-dns/</a><br>
><br>
> Looks promising but in the end I think I end up with the same amount of<br>
> code. (a vcl_fetch with 1000s of ifs)<br>
<br>
</div>I don't think there's any avoiding that unless there's some kind of<br>
logical, programmable pattern for mapping the requested host to the<br>
destination host. The examples you gave sound fairly arbitrary, which<br>
just means you'll have to have a great big list.<br>
<br>
How many actual servers (as opposed to domains) are serving as<br>
destinations? If it's still in the thousands, then you're probably<br>
better off looking at a forward-proxy for your solution, although as<br>
mentioned you could put Varnish in front of it to provide caching.<br>
<br>
If the number of servers you connect to is more reasonable, then it<br>
might be plausible to use varnish directly. The Host: header can be<br>
changed by VCL and is independent of the backend definition.<br>
<br>
The main performance issue you'd have, I think, is from the sheer number<br>
of rewrite rules you'd have to have. This is especially the case if<br>
you're having to run a string comparison or regular expression match<br>
over every rule until you find a match. If you control the DNS for the<br>
proxied domain, you can mitigate this a bit by spreading them across<br>
multiple IP addresses.<br>
<br>
For a better solution, I think you'd want to have something that can<br>
look up the requested domain name using a hash table or similar, so you<br>
get essentially constant-time lookups. I don't know of anything that can<br>
do that "out of the box", but you could do it with Varnish using inline<br>
C. It might be worthwhile doing a small-scale test with regular VCL for<br>
the rewrites on a few dozen domains as a proof-of-concept, then if<br>
you're happy with the results look at creating a more scalable rewriter.<br>
<div><div></div><div class="h5"><br>
_______________________________________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org">varnish-misc@varnish-cache.org</a><br>
<a href="http://lists.varnish-cache.org/mailman/listinfo/varnish-misc" target="_blank">http://lists.varnish-cache.org/mailman/listinfo/varnish-misc</a><br>
</div></div></blockquote></div><br>