2013-04-18 2 views
2

약 30 개의 웹 사이트를 호스팅하는 Rackspace 클라우드 서버에서 cPanel을 실행 중입니다. 나는 Varnish 3.0.3 + Apache 2.2.23을 사용하고 있습니다. 랜덤 503 에러가 나옵니다. httpd 프로세스를 다시 시작하면 사라집니다. 아파치 error_log를 검사했는데 503 오류와 관련된 내용이 표시되지 않습니다.Varnish/Apache Random 503 오류

backend default { 
    .host = "198.61.161.65"; 
    .port = "8080"; 
    .connect_timeout = 600s; 
    .first_byte_timeout = 600s; 
    .between_bytes_timeout = 600s; 
    } 

가 여기 내 니스 시작 매개 변수를 다음과 같습니다 :

-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 

내가 varnishlog를 실행하고 몇 가지 오류를 기록

여기 내 니스의 설정입니다. 그들은 모두 TxResponse = Service Unavailable을 가지고 있습니다. 나에게 이것은 Apache가 적시에 Varnish의 요청에 응답하지 않는다는 것을 의미합니다.

17 SessionOpen c 74.133.75.136 54227 :80 
17 ReqStart  c 74.133.75.136 54227 1219297893 
17 RxRequest c GET 
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 

내가 내 default.vcl 파일에 다음과 같은 추가 시도했다 : 예를 들면 다음과 같습니다의 일부 (503) 오류의 무렵

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; 
... 
} 

가, 나는 PHP 치명적인 오류, 스크립트의 조기 종료를 발견 헤더 및 요청이 Apache error_log에 발생할 수있는 구성 오류로 인해 10 개의 내부 리디렉션 제한을 초과했습니다.

나는 Varnish 및 제한 시간 값에 대한 메모리를 늘리거나 줄이려고 시도했습니다. 더 높은 http_max_hdr 및 http_resp_hdr_len 값을 추가하려고했습니다.

답변

1

우리는이 서버에서 APC를 사용하고 있으며 할당 된 메모리 크기는 96M에 불과했습니다. 몇 차례 메모리를 늘리고 사용량을 추적 한 후 우리는 312M에 정착했습니다. 캐시 적중률은 99.7 %이고 조각화는 < 0.2 %입니다. Apache 503 오류는 거의 완전히 중단되었습니다.

0

문제 해결 나에게 도움이 무엇인가에 따라 : 다음 명령을 실행 한 후

를, 내가 오류에 대해 알고 : - : 자세한 수

$ varnishlog -b -q 'FetchError' 

오류가 있었다 "EOF 첫 번째 오류를 읽을 HTTP FetchError" "first_byte_timeout"을 설정 한 후 다음 varnish site

에서 볼 수, 문제가 수정되었습니다 :

backend default { 
    .host = "127.0.0.1"; 
    .port = "8888"; 
    .connect_timeout = 1s; # Wait a maximum of 1s for backend connection (Apache, Nginx, etc...) 
    .first_byte_timeout = 5s; # Wait a maximum of 5s for the first byte to come from your backend 
    .between_bytes_timeout = 2s; # Wait a maximum of 2s between each bytes sent 
} 

세부 사항은 Varnish 503 Solutions