<div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span style="font-family:arial,sans-serif;font-size:13px">I cannot understand what you want to accomplish with your vcl, but in your conditions a classic configuration is:</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px">- F5 balance the vip on the two cache<br></span><span style="font-family:arial,sans-serif;font-size:13px">- the cache balance on the 3 web servers as backend</span></blockquote>
<div><br></div><div>Hello,</div><div><br></div><div> Thanks for your input. That was exactly what needed to confirm what I was thinking we'd ought to do. I'm going to go ahead and recommend that we take the web servers out of the vip pool and instead point the vip at the two varnish cache nodes. I'm thinking we'll need a heartbeat established between the two (something like keepalived) to enable the failover so that each node can assume the identity of the VIP ip.</div>
<div><br></div><div>But I'm sorry if what I posted from my config was unclear. </div><div><br></div><div>All I am really still curious about at this point is whether I should post this section on my first node:</div><div>
<br></div><div><div style="font-family:arial,sans-serif;font-size:13px"><div>if (req.restarts == 0) {</div><div> if (client.ip == "10.10.40.8" || client.ip == "10.10.40.9") {</div><div> set req.backend = www;</div>
<div> } elsif (server.ip == "10.10.40.8") {</div><div> set req.backend = varnish2;</div><div> } else {</div><div> set req.backend = varnish1;</div><div> }</div><div> } elsif (req.restarts >= 2) {</div>
<div> return (pass);</div><div><br></div><div>And this configuration on the second node:</div><div><br></div><div><div><div>if (client.ip == "10.10.40.8" || client.ip == "10.10.40.9") {</div><div>
set req.backend = www;</div><div> } elsif (server.ip == "10.10.40.9") {</div><div> set req.backend = varnish1;</div><div> } else {</div><div> set req.backend = varnish2;</div>
<div> }</div></div></div><div><br></div><div><br></div><div>And I am wondering what the purpose of that stanza is. In the config I am inheriting the first version of the stanza that I show (the one on top) is present in the same exact way on both varnish nodes. However what I am thinking is that it needs to be varied the way that I am demonstrating here from one machine to the other. </div>
</div><div style="font-family:arial,sans-serif;font-size:13px"></div></div><div><br></div><div>In the demo I'm showing the first varnish node is 10.10.40.8 and the second varnish node is 10.10.40.9.</div><div><br></div>
<div>I'd really love to be clear on what that stanza is trying to accomplish.</div><div><br></div><div>Here's the full config to provide some context. </div><div><br></div><div><br></div><div><div>backend web1 {</div>
<div> .host = “10.10.40.42”;</div><div> .port = "80";</div><div> .connect_timeout = 45s;</div><div> .first_byte_timeout = 45s;</div><div> .between_bytes_timeout = 45s;</div><div> .max_connections = 70;</div>
<div> .probe = {</div><div> .url = "/healthcheck.php";</div><div> .timeout = 5s;</div><div> .interval = 30s;</div><div> .window = 10;</div><div> .threshold = 1;</div><div> }</div>
<div>}</div><div><br></div><div>backend web2 {</div><div> .host = "10.10.40.10";</div><div> .port = "80";</div><div> .connect_timeout = 45s;</div><div> .first_byte_timeout = 45s;</div><div>
.between_bytes_timeout = 45s;</div><div> .max_connections = 70;</div><div> .probe = {</div><div> .url = "/healthcheck.php";</div><div> .timeout = 5s;</div><div> .interval = 30s;</div>
<div> .window = 10;</div><div> .threshold = 1;</div><div> }</div><div>}</div><div><br></div><div>backend web3 {</div><div> .host = "10.10.40.11";</div><div> .port = "80";</div><div>
.connect_timeout = 45s;</div><div> .first_byte_timeout = 45s;</div><div> .between_bytes_timeout = 45s;</div><div> .max_connections = 70;</div><div> .probe = {</div><div> .url = "/healthcheck.php";</div>
<div> .timeout = 5s;</div><div> .interval = 30s;</div><div> .window = 10;</div><div> .threshold = 1;</div><div> }</div><div>}</div><div><br></div><div>backend web4 {</div><div> .host = "10.10.40.12";</div>
<div> .port = "80";</div><div> .connect_timeout = 45s;</div><div> .first_byte_timeout = 45s;</div><div> .between_bytes_timeout = 45s;</div><div> .max_connections = 70;</div><div> .probe = {</div>
<div> .url = "/healthcheck.php";</div><div> .timeout = 5s;</div><div> .interval = 30s;</div><div> .window = 10;</div><div> .threshold = 1;</div><div> }</div><div>}</div><div>
<br></div><div>acl purge {</div><div> "localhost";</div><div> "127.0.0.1";</div><div> "10.10.40.8";</div><div> "10.10.40.9";</div><div>}</div><div><br></div><div>director www round-robin {</div>
<div> { .backend = web1; }</div><div> { .backend = web2; }</div><div> { .backend = web3; }</div><div> { .backend = web4; }</div><div>}</div><div><br></div><div>sub vcl_recv {</div><div> set req.backend = www;</div>
<div> set req.grace = 6h;</div><div> if (!req.backend.healthy) {</div><div> set req.grace = 24h;</div><div> }</div><div> set req.http.X-Forwarded-For = req.http.X-Forwarded-For ", " client.ip;</div>
<div> if (req.http.host ~ "^origin\.(.+\.|)my_site_tv\.com$") {</div><div> return (pass);</div><div> }</div><div> if (req.http.host ~ ".*\.<a href="http://my_site_tv.com">my_site_tv.com</a>|<a href="http://my_site_tv.com">my_site_tv.com</a>") {</div>
<div> /* allow (origin.)<a href="http://stage.m.my_site_tv.com">stage.m.my_site_tv.com</a> to be a separate host */</div><div> if (req.http.host != "<a href="http://stage.m.my_site_tv.com">stage.m.my_site_tv.com</a>") {</div>
<div> set req.http.host = "<a href="http://stage.my_site_tv.com">stage.my_site_tv.com</a>";</div><div> }</div><div> } else {</div><div> return (pass);</div><div> }</div><div> if (req.request == "PURGE") {</div>
<div> if (!client.ip ~ purge) {</div><div> error 405 "Not allowed.";</div><div> }</div><div> return (lookup);</div><div> }</div><div> if (req.request != "GET" &&</div>
<div> req.request != "HEAD" &&</div><div> req.request != "PUT" &&</div><div> req.request != "POST" &&</div><div> req.request != "TRACE" &&</div>
<div> req.request != "OPTIONS" &&</div><div> req.request != "DELETE") {</div><div> return (pipe);</div><div> }</div><div> if (req.request != "GET" && req.request != "HEAD") {</div>
<div> return (pass);</div><div> }</div><div> if (req.url ~ "sites/all/modules/custom/my_site__ad/ads.html\?.*") {</div><div> set req.url = "/sites/all/modules/custom/my_site__ad/ads.html";</div>
<div> }</div><div> if (req.url ~ "eyeblaster/addineyeV2.html\?.*") {</div><div> set req.url = "/eyeblaster/addineyeV2.html";</div><div> }</div><div> if (req.url ~ "ahah_helper\.php|my_site__points\.php|install\.php|update\.php|cron\.php|/json(:?\?.*)?$") {</div>
<div> return (pass);</div><div> }</div><div> if (req.http.Authorization) {</div><div> return (pass);</div><div> }</div><div> if (req.url ~ "login" || req.url ~ "logout") {</div>
<div> return (pass);</div><div> }</div><div> if (req.url ~ "^/admin/" || req.url ~ "^/node/add/") {</div><div> return (pass);</div><div> }</div><div> if (req.http.Cache-Control ~ "no-cache") {</div>
<div> // return (pass);</div><div> }</div><div> if (req.http.Cookie ~ "(VARNISH|DRUPAL_UID|LOGGED_IN|SESS|_twitter_sess)") {</div><div> set req.http.Cookie = regsuball(req.http.Cookie, "(^|;\s*)(__[a-z]+|has_js)=[^;]*", "");</div>
<div> set req.http.Cookie = regsub(req.http.Cookie, "^;\s*", "");</div><div> } else {</div><div> unset req.http.Cookie;</div><div> }</div><div> /* removed varnish cache backend logic */</div>
<div> if (req.restarts == 0) {</div><div> set req.backend = www;</div><div> } elsif (req.restarts >= 2) {</div><div> return (pass);</div><div> }</div><div> if (req.restarts >= 2) {</div><div>
return (pass);</div><div> }</div><div> if (req.url ~ "\.(ico|jpg|jpeg|png|gif|gz|tgz|bz2|tbz|mp3|ogg|swf|ICO|JPG|JPEG|PNG|GIF|GZ|TGZ|BZ2|TBZ|MP3|OOG|SWF)") {</div><div> unset req.http.Accept-Encoding;</div>
<div> }</div><div> if (req.url ~ "^/(sites/all/modules/my_site_tv_admanager/includes/ads.php|doubleclick/DARTIframe.html)(\?.*|)$") {</div><div> set req.url = regsub(req.url, "\?.*$", "");</div>
<div> }</div><div> if (req.http.Accept-Encoding ~ "gzip") {</div><div> set req.http.Accept-Encoding = "gzip";</div><div> } elsif (req.http.Accept-Encoding ~ "deflate") {</div>
<div> set req.http.Accept-Encoding = "deflate";</div><div> } else {</div><div> unset req.http.Accept-Encoding;</div><div> }</div><div> return (lookup);</div><div>}</div><div><br></div><div>
sub vcl_pipe {</div><div> set bereq.http.connection = "close";</div><div> return (pipe);</div><div>}</div><div><br></div><div>sub vcl_pass {</div><div> return (pass);</div><div>}</div><div><br></div><div>
sub vcl_hash {</div><div> set req.hash += req.url;</div><div> set req.hash += req.http.host;</div><div> if (req.http.Cookie ~ "VARNISH|DRUPAL_UID|LOGGED_IN") {</div><div> set req.hash += req.http.Cookie;</div>
<div> }</div><div> return (hash);</div><div>}</div><div><br></div><div>sub vcl_hit {</div><div> if (req.request == "PURGE") {</div><div> set obj.ttl = 0s;</div><div> error 200 "Purged.";</div>
<div> }</div><div>}</div><div><br></div><div>sub vcl_fetch {</div><div> if (beresp.status == 500) {</div><div> set req.http.X-Varnish-Error = "1";</div><div> restart;</div><div> }</div><div>
set beresp.grace = 6h;</div><div> # Set a short circuit cache lifetime for resp codes above 302</div><div> if (beresp.status > 302) {</div><div> <span class="" style="white-space:pre"> </span>set beresp.ttl = 60s;</div>
<div> <span class="" style="white-space:pre"> </span>set beresp.http.Cache-Control = "max-age = 60";</div><div> }</div><div> if (beresp.http.Edge-control ~ "no-store") {</div><div> set beresp.http.storage = "1";</div>
<div> set beresp.cacheable = false;</div><div> return (pass);</div><div> }</div><div> if (beresp.status >= 300 || !beresp.cacheable) {</div><div> set beresp.http.Varnish-X-Cacheable = "Not Cacheable";</div>
<div> set beresp.http.storage = "1";</div><div> return (pass);</div><div> }</div><div> if (beresp.http.Set-Cookie) {</div><div> return (pass);</div><div> }</div><div> if (beresp.cacheable) {</div>
<div> unset beresp.http.expires;</div><div> set beresp.ttl = 600s;</div><div> set beresp.http.Cache-Control = "max-age = 600";</div><div> if (req.url ~ "\.(ico|jpg|jpeg|png|gif|gz|tgz|bz2|tbz|mp3|ogg|swf|ICO|JPG|JPEG|PNG|GIF|GZ|TGZ|BZ2|TBZ|MP3|OOG|SWF)") {</div>
<div> set beresp.ttl = 43829m;</div><div> set beresp.http.Cache-Control = "max-age = 1000000";</div><div> }</div><div> }</div><div> return (deliver);</div><div>}</div><div><br>
</div><div>sub vcl_deliver {</div><div> if (obj.hits > 0) {</div><div> set resp.http.Varnish-X-Cache = "HIT";</div><div> set resp.http.Varnish-X-Cache-Hits = obj.hits;</div><div> } else {</div>
<div> set resp.http.Varnish-X-Cache = "MISS";</div><div> }</div><div> return (deliver);</div><div>}</div><div><br></div><div>sub vcl_error {</div><div> if (req.restarts == 0) {</div><div> return (restart);</div>
<div> }</div><div> if (req.http.X-Varnish-Error != "1") {</div><div> set req.http.X-Varnish-Error = "1";</div><div> return (restart);</div><div> }</div><div> set obj.http.Content-Type = "text/html; charset=utf-8";</div>
<div> synthetic {"</div><div><br></div><div> <?xml version="1.0" encoding="utf-8"?></div><div> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"</div><div> "<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</a>"></div>
<div> <html></div><div> <head></div><div> <title><a href="http://my_site_tv.com">my_site_tv.com</a> "} obj.status " " obj.response {"</title></div><div> <style type="text/css"></div>
<div> body {background-color: #fff; margin: auto;}</div><div> #page {width: 1000px; margin: 0 auto; background-color: #fff;}</div><div> </style></div><div> </head></div>
<div> <body></div><div> <div id="page"></div><div> <img src="<a href="http://www.my_site_tv.com/media/site-unavailable/site-unavailable.jpg">http://www.my_site_tv.com/media/site-unavailable/site-unavailable.jpg</a>" width="1000" height="700" /></div>
<div> <!--</div><div> <h4>Debug</h4></div><div> <pre></div><div> Status: "} obj.status {"</div><div> Response: "} obj.response {"</div>
<div> XID: "} req.xid {"</div><div> </pre></div><div> --></div><div> </div></div><div> </body></div><div> </html></div>
<div><br></div><div> "};</div><div> return (deliver);</div><div>}</div></div><div><br></div><div><br></div><div>Thanks</div><div>Tim</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Apr 13, 2014 at 4:15 AM, emilio brambilla <span dir="ltr"><<a href="mailto:emilio@antispam.it" target="_blank">emilio@antispam.it</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">hello,<div class=""><br>
<br>
On 2014/04/12 22:00, Tim Dunphy wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
So if the load balancer is handling all the traffic into the site and the caching hosts are not referenced in the load balancer, don't things need to be structured differently in order for the site to benefit from the acceleration they are trying to use?<br>
</blockquote></div>
I cannot understand what you want to accomplish with your vcl, but in your conditions a classic configuration is:<br>
<br>
- F5 balance the vip on the two cache<br>
- the cache balance on the 3 web servers as backend<span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
bye,<br>
emilio</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
______________________________<u></u>_________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org" target="_blank">varnish-misc@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" target="_blank">https://www.varnish-cache.org/<u></u>lists/mailman/listinfo/<u></u>varnish-misc</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>GPG me!!<br><br>gpg --keyserver <a href="http://pool.sks-keyservers.net" target="_blank">pool.sks-keyservers.net</a> --recv-keys F186197B<br><br>
</div>