Example VCL for backend check

Per Buer perbu at linpro.no
Mon Dec 15 21:42:37 CET 2008


Hi Alex.

Good to hear you got it working.:-) I written a page about load
balancing a few days ago and I've added your vcl_recv there. It's
located at http://varnish.projects.linpro.no/wiki/LoadBalancing - linked
from http://varnish.projects.linpro.no/wiki/VarnishFeatures - it might
need some proofreading if anyone got some spare time.

I'm not aware of any way to monitor pageload time from varnish. I guess
the information is available in varnish so it might not be to hard to
expose this in VCL. At the moment its not on the list, however.


Per.


Alex Davies wrote:
> Hi Per,
> 
> Thank-you for your help? With a minor change, your configuration worked
> extremely well - is there a wiki for Varnish that I can post it? I've
> written out a full, working, configuration for a two-host director below
> which might be of use in the VCL examples page.
> 
> Another question - is there an easy way to monitor the average pageload
> time that varnish experiences when contacting the backends?
> 
> Many thanks for your help,
> 
> Alex
> 
> --
> 
> backend wwxx {
> .host = "xx.xx.xx.xx";
> .port = "80";
>   .probe = {
>   .url = "/";
>   .timeout = 34 ms;
>   .interval = 1s;
>   .window = 10;
>   .threshold = 8;
> }
> }
> 
> backend wwxx {
> .host = "xx.xx.xx.xx";
> .port = "80";
>   .probe = {
>   .url = "/";
>   .timeout = 34 ms;
>   .interval = 1s;
>   .window = 10;
>   .threshold = 8;
> }
> }
> 
> director director random {
>  {
>    .backend = wwxx;
>    .weight = 100;
>  }
>  {
>    .backend = wwxx;
>    .weight = 100;
>  }
> }
> 
> sub vcl_recv {
>    if (req.http.host ~ "^(www.)?mysite.com <http://mysite.com>$") {
>        set req.backend = director;
>    }
> }
> 
> 
> 
> On Thu, Dec 11, 2008 at 6:03 PM, Per Buer <perbu at linpro.no
> <mailto:perbu at linpro.no>> wrote:
>> Hi Alex,
>>
>> Alex Davies wrote:
>>
>>> I'm figuring that I need something like
>>>
>>> # web1
>>> backend default {
>>
>> backends must have uniqe names so you might use:
>>
>> backend web1 {
>>>   .host = "xxx.xxx";
>>>   .port = "80";
>>>     .probe = {
>>>     .url = "/";
>>>     .timeout = 34 ms;
>>>     .interval = 1s;
>>>     .window = 10;
>>>     .threshold = 8;
>>>   }
>>> }
>>>
>>> # web2
>>> backend default {
>>
>> backend web2{
>>
>>>   .host = "xxx.xxx";
>>>   .port = "80";
>>>     .probe = {
>>>     .url = "/";
>>>     .timeout = 34 ms;
>>>     .interval = 1s;
>>>     .window = 10;
>>>     .threshold = 8;
>>>   }
>>> }
>>>
>>> And then something to glue all the backends together, but I see many
>>> different options in the manuals! I'd appreciate a pointer in the
>>> right direction if anyone could spare one. The vcl man page isnt
>>> entirely obvious to me!
>>
>> Use a director, like this:
>>
>> director www-director round-robin {
>>        {
>>                .backend = web1;
>>                .weight = 100;
>>        }
>>        {
>>                 .backend = web2;
>>                 .weight = 200;
>>        }
>> }
>>
>>
>> --
>> Per Buer - Leder Infrastruktur og Drift - Redpill Linpro
>> Telefon: 21 54 41 21 - Mobil: 958 39 117
>> http://linpro.no/ | http://redpill.se/
>>
>>
>> _______________________________________________
>> varnish-misc mailing list
>> varnish-misc at projects.linpro.no <mailto:varnish-misc at projects.linpro.no>
>> http://projects.linpro.no/mailman/listinfo/varnish-misc
>>
>>
> 
> 
> 
> -- 
> Alex Davies
> 
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> the sender immediately by e-mail and delete this e-mail permanently.
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at projects.linpro.no
> http://projects.linpro.no/mailman/listinfo/varnish-misc


-- 
Per Buer - Leder Infrastruktur og Drift - Redpill Linpro
Telefon: 21 54 41 21 - Mobil: 958 39 117
http://linpro.no/ | http://redpill.se/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20081215/2944594c/attachment-0003.pgp>


More information about the varnish-misc mailing list