Varnish/Apache Random 503 Errors -
i'm running cpanel on rackspace cloud server that's hosting 30 websites. i'm using varnish 3.0.3 + apache 2.2.23. i'm getting random 503 errors. if restart httpd process, go away. checked apache error_log, , don't see related 503 error.
here's varnish config:
backend default { .host = "198.61.161.65"; .port = "8080"; .connect_timeout = 600s; .first_byte_timeout = 600s; .between_bytes_timeout = 600s; } here's varnish startup parameters:
-a :80 -f /etc/varnish/default.vcl -t 127.0.0.1:6082 -t 120 -w 1,1000,120 -u varnish -g varnish -s /etc/varnish/secret -p http_max_hdr=256 -p http_resp_hdr_len=8192 -p http_range_support=on -s malloc,768m i ran varnishlog , recorded of errors. have txresponse=service unavailable in them. me, means apache isn't responding request varnish in timely manner. here's example:
17 sessionopen c 74.133.75.136 54227 :80 17 reqstart c 74.133.75.136 54227 1219297893 17 rxrequest c 17 rxurl c / 17 rxprotocol c http/1.1 17 rxheader c host: www.archerytrade.org 17 rxheader c user-agent: mozilla/5.0 (macintosh; intel mac os x 10.8; rv:20.0) gecko/20100101 firefox/20.0 17 rxheader c accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 17 rxheader c accept-language: en-us,en;q=0.5 17 rxheader c accept-encoding: gzip, deflate 17 rxheader c dnt: 1 17 rxheader c connection: keep-alive 17 vcl_call c recv lookup 17 vcl_call c hash 17 hash c / 17 hash c www.archerytrade.org 17 vcl_return c hash 17 vcl_call c miss fetch 17 backend c 18 default default 17 fetcherror c http first read error: -1 0 (success) 17 vcl_call c error deliver 17 vcl_call c deliver deliver 17 txprotocol c http/1.1 17 txstatus c 503 17 txresponse c service unavailable 17 txheader c server: varnish 17 txheader c content-type: text/html; charset=utf-8 17 txheader c retry-after: 5 17 txheader c content-length: 441 17 txheader c accept-ranges: bytes 17 txheader c date: wed, 17 apr 2013 01:39:52 gmt 17 txheader c x-varnish: 1219297893 17 txheader c age: 0 17 txheader c via: 1.1 varnish 17 txheader c connection: close 17 length c 441 17 reqend c 1219297893 1366162792.398471832 1366162792.541639328 0.000244379 0.143036604 0.000130892 17 sessionclose c error 17 statsess c 74.133.75.136 54227 0 1 1 0 0 0 257 441 i've tried adding following default.vcl file:
sub vcl_recv { set req.grace = 15s; ... } sub vcl_fetch { if (beresp.status == 500 || beresp.status == 503) { set beresp.saintmode = 10s; return(restart); } set beresp.grace = 1h; ... } around time of 503 errors, found php fatal error, premature end of script headers, , request exceeded limit of 10 internal redirects due probable configuration error, in apache error_log.
i've tried increasing/decreasing memory varnish , timeout values. i've tried adding higher http_max_hdr , http_resp_hdr_len values.
we're using apc on server, , allotted memory size 96m. after increasing memory few times , tracking usage, settled on 312m. cache hit rate 99.7% , fragmentation < 0.2%. apache 503 errors have stopped.
Comments
Post a Comment