The best way would be to use a jump table.
By that, I mean to make multiple subroutines in C, and then to jump to the different subroutines by looking
up pointers to the subroutines using a string hashing/lookup system.

You would also need a flag to indicate whether the hash has been 'initialized' yet as well. The initialization would consist of storing function pointers at the hash locations corresponding to each
of the domains.

I attempted to do this myself when I first started using varnish, but I was having problems with varnish crashing when attempting to use the code I wrote in C. There may be limitations to the C code that can be
used.

On 3/6/2011 5:39 PM, AD wrote:
Hello,
what is the best way to run an instance of varnish that may need different vcl configurations for each hostname. This could end up being 100-500 includes to map to each hostname and then a long if/then block based on the hostname. Is there a more scalable way to deal with this? We have been toying with running one large varnish instance with tons of includes or possibly running multiple instances of varnish (with the config broken up) or spreading the load across different clusters (kind of like sharding) based on hostname to keep the configuration simple.

Any best practices here? Are there any notes on the performance impact of the size of the VCL or the amount of if/then statements in vcl_recv to process a unique call function ?

Thanks


_______________________________________________
varnish-misc mailing list
[email protected]
http://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

_______________________________________________
varnish-misc mailing list
[email protected]
http://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Reply via email to