Multiple directors

Yiannis Karayiannidis yianniska at gmail.com
Wed Apr 13 15:02:45 CEST 2016


Hi all,
Varnish has made an incredible difference to our website,
for the first we 're trying to use multiple directors.
We're wondering if we got the correct conf syntax for using multiple
directors.

We've a section in our conf like the below.

##############################
vcl 4.0;

import std;
import directors;


probe prb_www_xxx_spo {
    .request =
    "HEAD http://xxx.xxx.com/ HTTP/1.1"
    "Host: 127.0.0.2"
    "User-Agent: varnish-probe"
    "Connection: close";
    .timeout         = 10s;
    .interval     = 4s;
    .window         = 10;
    .threshold     = 8;
}

########

probe prb_yyy_btn_spo {
    .request =
    "HEAD http://yyy.yyy.com/ HTTP/1.1"
    "Host: 127.0.0.2"
    "User-Agent: varnish-probe"
    "Connection: close";
    .timeout         = 10s;
    .interval     = 4s;
    .window         = 10;
    .threshold     = 8;
}



# BACKENDS FOR xxx.xxx.COM
###########################################################################################################################################

backend web1_www_xxx_spo {
    .host = "111.111.111.121";
    .port = "80";
    .probe = prb_www_xxx_spo;
}

backend web2_www_xxx_spo {
    .host = "111.111.111.122";
    .port = "80";
    .probe = prb_www_xxx_spo;
}

sub vcl_init    {
    new dir_www_xxx_spo = directors.hash();
        dir_www_xxx_spo.add_backend(web1_www_xxx_spo, 1.0);
        dir_www_xxx_spo.add_backend(web2_www_xxx_spo, 1.0);
}



# BACKENDS FOR yyy.yyy.COM
######################################################################################################################################

backend web1_www_yyy_spo {
    .host = "111.111.111.123";
    .port = "80";
    .probe = prb_www_yyy_spo;
}

backend web2_www_yyy_spo {
    .host = "111.111.111.124";
    .port = "80";
    .probe = prb_www_yyy_spo;
}

sub vcl_init    {
    new dir_www_yyy_spo = directors.hash();
        dir_www_yyy_spo.add_backend(web1_www_yyy_spo, 1.0);
        dir_www_yyy_spo.add_backend(web2_www_yyy_spo, 1.0);
}


Is that ok can we have multiple

*sub vcl_init ?*
if not which is the correct method for having multiple directors in the vcl?

Thanks in advance
Yiannis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20160413/23f8de6b/attachment.html>


More information about the varnish-misc mailing list