Adjusting keep-alive timeout of backend-connections

Kristian Grønfeldt Sørensen ksorensen at nordija.com
Mon Oct 4 18:16:24 CEST 2010


Hi,

Is there any way of configuring how long a keep-alive connection to a
backend server will be kept open? 

When load-testing my Varnish-2.1.3 setup I see intermittent 503-errors.
arnishlog tells me that it is caused by a HTTP read error (connection
reset): 

   98 FetchError   c http read error: 104 

(Full log of the request is shown below.)
As far as I can understand, this error happens because the
backend-server closed the connection at the same time that Varnish sent
the request. I suspect errors like these will disappear with 2.1.4, as I
believe this is the same problem reported in issue #749, which have been
fixed in 2.1.4 by retrying on a new connection. However, my preferred
way of dealing with this would be to configure the keep-alive timeout of
backend-connection to be slightly lower than the configured timeout of
the backend server, so that Varnish will always be the one which closes
the connection (assuming that the backend server does not prematurely
close the connection). This way I should be able to avoid restarting the
request. Is there an easy way of achieving this with 2.1.3?

Entire request:

   98 ReqStart     c 192.168.1.24 35632 788531137
   98 RxRequest    c POST
   98 RxURL        c /my/url
   98 RxProtocol   c HTTP/1.1
   98 RxHeader     c Connection: keep-alive
   98 RxHeader     c Accept-Encoding: gzip,deflate
   98 RxHeader     c Cache-Control: no-cache
   98 RxHeader     c User-Agent: Mozilla/5.0 (X11; U; Linux sh4; rv:1.7.12) Gecko/20100326 Kreatel
   98 RxHeader     c Pragma: no-cache
   98 RxHeader     c Content-Type: text/plain
   98 RxHeader     c Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
   98 RxHeader     c Keep-Alive: 300
   98 RxHeader     c Content-Length: 228
   98 RxHeader     c Host: 192.168.3.20
   98 VCL_call     c recv pass
   98 VCL_call     c hash hash
   98 VCL_call     c pass pass
   98 Backend      c 95 defaultdirector backend1
   98 FetchError   c http read error: 104
   98 VCL_call     c error deliver
   98 VCL_call     c deliver deliver
   98 TxProtocol   c HTTP/1.1
   98 TxStatus     c 503
   98 TxResponse   c Service Unavailable
   98 TxHeader     c Server: Varnish
   98 TxHeader     c Retry-After: 0
   98 TxHeader     c Content-Type: text/html; charset=utf-8
   98 TxHeader     c Content-Length: 418
   98 TxHeader     c Date: Mon, 04 Oct 2010 09:55:29 GMT
   98 TxHeader     c X-Varnish: 788531137
   98 TxHeader     c Age: 0
   98 TxHeader     c Via: 1.1 varnish
   98 TxHeader     c Connection: close
   98 Length       c 418
   98 ReqEnd       c 788531137 1286186129.917763948 1286186129.930047989 0.002107859 0.012248993 0.000035048


Regards 
Kristian Sørensen






More information about the varnish-misc mailing list