Varnish Error 503 Service Unavailable / Service Unavailable / Guru Meditation

Varnish Error 503 Service Unavailable / Service Unavailable / Guru Meditation

Using Varnish cache on a Magento web shop will make your website fly. However, using third party extensions on a robust database could lead into a “503 Service Unavailable” varnish error. For example, ManaDev Layered Navigation Pro extension will leand into this problem if you have a pretty high number of product attributes. If we check varnishlog we get:

11 VCL_return c hash
 11 VCL_call c miss fetch
 11 Backend c 13 default default
 11 FetchError c http first read error: -2 0 (No error recorded)
 11 VCL_call c error deliver
 11 VCL_call c deliver deliver
 11 TxProtocol c HTTP/1.1
 11 TxStatus c 503
 11 TxResponse c Service Unavailable
 11 TxHeader c Server: Varnish
 11 TxHeader c Content-Type: text/html; charset=utf-8
 11 TxHeader c Retry-After: 5
 11 TxHeader c Content-Length: 419
 11 TxHeader c Accept-Ranges: bytes
 11 TxHeader c Date: Sat, 24 Aug 2013 10:08:58 GMT
 11 TxHeader c Connection: close

This means that our backend returns more data than varnish can handle. We need to increase ‘http_req_size’, which defaults to 32768 bytes. How we do this?

Edit /etc/default/varnish file and add this paramater, with a higher value. For example:

DAEMON_OPTS="-a website.com:80 \
             -T drr0003:6082 \
             -f /etc/varnish/website.vcl \
             -S /etc/varnish/secret \
             -p http_req_size=64000 \
             -s malloc,2G"

Save the file, restart varnish and the problem should be solved:

root@stage:~# service varnish restart

Share this post

Comments ( 0 )

Leave a comment