TheYorker
TheYorker

Reputation: 11

Varnish 503 Error/No backend connection

I'm currently using varnish for my website, previously it was working fine with no problems but today all I am getting is a 503 Error when trying to access any part of my website and this is what I am getting back from varnishlog.

3 VCL_return   c pass                                                                                            
3 FetchError   c no backend connection                                                                           
3 VCL_call     c error                                                                                           
3 VCL_return   c deliver                                                                                         
3 VCL_call     c deliver                                                                                         
3 VCL_return   c deliver                                                                                         
3 TxProtocol   c HTTP/1.1                                                                                        
3 TxStatus     c 503                                                                                             
3 TxResponse   c Service Unavailable                                                                             
3 TxHeader     c Server: Varnish                                                                                 
3 TxHeader     c Retry-After: 0                                                                                  
3 TxHeader     c Content-Type: text/html; charset=utf-8                                                          
3 TxHeader     c Content-Length: 418                                                                             
3 TxHeader     c Date: Sat, 05 Mar 2016 15:25:44 GMT                                                             
3 TxHeader     c X-Varnish: 765008569                                                                            
3 TxHeader     c Age: 0                                                                                          
3 TxHeader     c Via: 1.1 varnish                                                                                
3 TxHeader     c Connection: close                                                                               
3 Length       c 418                                                                                             
3 ReqEnd       c 765008569 1457191544.916952610 1457191544.917085171 0.000094652 0.000080585 0.000051975         
3 SessionClose c error                                                                                           
3 StatSess     c 185.106.92.245 33848 0 1 1 0 1 0 234 418  

Here is my configuration for the vcl

backend default {
.host = "127.0.0.1";
.port = "8080";
.connect_timeout = 1.5s;
.first_byte_timeout = 45s;
.between_bytes_timeout = 30s;
.probe = {
    .url ="/";
    .timeout = 34ms;
    .interval = 1s;
    .window = 10;
    .threshold = 8;
    }
}

sub vcl_recv
{
    # Set Grace Time to one hour
    set req.grace = 1h;
}

sub vcl_fetch
{
    # Set the TTL for cache object to five minutes
    set beresp.ttl = 5m;

    # Set Grace Time to one hour
    set beresp.grace = 1h;
}

I have tried any solutions I can find none of which have improved the situation and my knowledge of this only goes so far. Any help would be appreciated.

Upvotes: 1

Views: 2625

Answers (1)

Jacob Rastad
Jacob Rastad

Reputation: 1171

In your probe settings you have a very short timeout 34ms

.probe = {
    .url ="/";
    .timeout = 34ms;
    .interval = 1s;
    .window = 10;
    .threshold = 8;
    }

Are you certain your site loads that quickly? If it doesn't then Varnish will mark that backend host as down and will therefore also return the error no backend connection

Upvotes: 1

Related Questions