<div dir="ltr">Hi guys,<div><br></div><div><br></div><div> I'm having an issue where my varnish server will stop working after a while of browsing around the site I'm using it with and throw a 503 server unavailable error.</div><div><br></div><div>In my varnish logs I'm getting a 'no backend connection error':</div><div><br></div><div><div> <b> 10 FetchError c no backend connection</b></div><div> 10 VCL_call c error deliver</div><div> 10 VCL_call c deliver deliver</div><div> 10 TxProtocol c HTTP/1.1</div><div> 10 TxStatus c 503</div><div> 10 TxResponse c Service Unavailable</div><div> 10 TxHeader c Server: Varnish</div><div><br></div><div><br></div><div>And if I do a GET on the healthcheck from the command line on the varnish server, I get a 503 response from varnish:</div><div><br></div><div><div>#GET <a href="http://wiki.example.com/healthcheck.php">http://wiki.example.com/healthcheck.php</a></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>503 Service Unavailable</title></div><div> </head></div><div> <body></div><div> <h1>Error 503 Service Unavailable</h1></div><div> <p>Service Unavailable</p></div><div> <h3>Guru Meditation:</h3></div><div> <p>XID: 2107225059</p></div><div> <hr></div><div> <p>Varnish cache server</p></div><div> </body></div><div></html></div></div><div><br></div><div>But if I do another GET on the healthcheck file from the varnish server to another apache VHOST on the same server as the wiki site that responds to the IP of the web server instead of the IP for the varnish server, the GET works:</div><div><br></div><div><div>#GET <a href="http://ops1.example.com/healthcheck.php">http://ops1.example.com/healthcheck.php</a></div><div>good</div></div><div><br></div><div><br></div><div>So I'm not sure why varnish is having trouble reaching the HC file. The web server is a little far from the varnish server. The varnish machines are in NYC and the web servers are in northern Virginia.</div><div><br></div><div>So I tried setting the timeouts in the varnish config to a really high number. And that was working for a while. But today I noticed that it stopped working. I'll have to restart the varnish service and browse the site for a while. Then it'll stop working again and produce the 503 error. It's pretty annoying!</div><div><br></div><div>I was wondering if there might be something in my VCL I could tweak to make this work? Or if the fact is that the web servers are simply too far from varnish for this to be practical. </div><div><br></div><div>Here's my VCL file. It's pretty basic:</div><div><br></div><div><div>backend web1 {</div><div> .host = "10.10.10.25";</div><div> .port = "80";</div><div> .connect_timeout = 1200s;</div><div> .first_byte_timeout = 1200s;</div><div> .between_bytes_timeout = 1200s;</div><div> .max_connections = 70;</div><div> .probe = {</div><div> .request =</div><div> "GET /healthcheck.php HTTP/1.1"</div><div> "Host: <a href="http://wiki.example.com">wiki.example.com</a>"</div><div> "Connection: close";</div><div> .interval = 10m;</div><div> .timeout = 60s;</div><div> .window = 3;</div><div> .threshold = 2;</div><div> }</div><div>}</div><div><br></div><div>backend web2 {</div><div> .host = "10.10.10.26";</div><div> .port = "80";</div><div> .connect_timeout = 1200s;</div><div> .first_byte_timeout = 1200s;</div><div> .between_bytes_timeout = 1200s;</div><div> .max_connections = 70;</div><div> .probe = {</div><div> .request =</div><div> "GET /healthcheck.php HTTP/1.1"</div><div> "Host: <a href="http://wiki.example.com">wiki.example.com</a>"</div><div> "Connection: close";</div><div> .interval = 10m;</div><div> .timeout = 60s;</div><div> .window = 3;</div><div> .threshold = 2;</div><div> }</div><div>}</div><div><br></div><div>director www round-robin {</div><div> { .backend = web1; }</div><div> { .backend = web2; }</div><div> }</div><div><br></div><div>sub vcl_recv {</div><div><br></div><div> if (req.url ~ "&action=submit($|/)") {</div><div> return (pass);</div><div> }</div><div><br></div><div> set req.backend = www;</div><div> return (lookup);</div><div>}</div><div><br></div><div>sub vcl_fetch {</div><div> set beresp.ttl = 3600s;</div><div> set beresp.grace = 4h;</div><div> return (deliver);</div><div>}</div><div><br></div><div><br></div><div>sub vcl_deliver {</div><div> if (obj.hits> 0) {</div><div> set resp.http.X-Cache = "HIT";</div><div> } else {</div><div> set resp.http.X-Cache = "MISS";</div><div> }</div><div> }</div></div><div><br></div><div>Thanks,</div><div>Tim</div><div><br></div><div><br></div><div><br></div>-- <br><div class="gmail_signature">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>
</div></div>