2012-02-07 150 views
2

期間擔任老物件我怎樣才能在獲取過期的對象或最大 輸出連接的服務的舊對象?清漆刷新

I¹ve配置在兩個vcl_recv作爲vcl_fetch寬限期。

我甚至試圖用聖人模式給我回一個³old²緩存的對象。

有人可以給我在這個問題上幫助?

sub vcl_recv { 

# Purge through http 
if (req.request == "PURGE") { 
if (!client.ip ~ purge) { 
error 405 "Not allowed."; 
} 
ban("req.url ~ " + req.url); 
error 200 "Purged."; 
} 

# Unset all cookies available 
if (req.http.cookie) { 
unset req.http.cookie; 
} 

if (req.request != "GET" && req.request != "HEAD") { 
/* We only deal with GET and HEAD by default */ 
return (pass); 
} 

# Adding Grace period in case backend lags 
set req.grace = 3d; 
return (lookup); 
} 
.... 
sub vcl_fetch { 
set beresp.grace = 4d; 
set beresp.saintmode = 50s; 
set beresp.ttl = 30s; 
return (deliver); 
} 
####緩存請求VARNISHLOG
0 Debug  - "lurker: 0x7f244cfd1e00 30 0" 
0 Debug  - "lurker: 0x7f244cfd1e00 30 0" 
0 Debug  - "lurker: 0x7f244cfd1e00 30 0" 
0 Debug  - "lurker: 0x7f244cfd1e00 30 0" 
0 Debug  - "lurker: 0x7f244cfd1e00 30 0" 
0 Debug  - "lurker: 0x7f244cfd1e00 30 0" 
0 Debug  - "lurker: 0x7f244cfd1e00 30 0" 
11 SessionOpen c XXX.XXX.XXX.XXX 60750 XXX.XXX.XXX.XXX:2002 
11 ReqStart  c XXX.XXX.XXX.XXX 60750 479090107 
11 RxRequest c GET 
11 RxURL  c /image/1156499/1601812475/45010cb14311wq1fd2da042ed599f3ad917005085c400/1181_615/crop 
11 RxProtocol c HTTP/1.0 
11 RxHeader  c Host: URL 
11 RxHeader  c X-Real-IP: XXX.XXX.XXX.XXX 
11 RxHeader  c X-Forwarded-For: XXX.XXX.XXX.XXX 
11 RxHeader  c Connection: close 
11 RxHeader  c User-Agent: GraphicalHttpClient 1.0.6 (Macintosh; Mac OS X 10.6.8; en_NL) 
11 VCL_call  c recv lookup 
11 VCL_call  c hash 
11 Hash   c /image/1156499/1601812475/45010cb14311wq1fd2da042ed599f3ad917005085c400/1181_615/crop 
11 Hash   c URL 
11 VCL_return c hash 
11 Hit   c 479090015 
11 VCL_call  c hit deliver 
11 VCL_call  c deliver deliver 
11 TxProtocol c HTTP/1.1 
11 TxStatus  c 200 
11 TxResponse c OK 
11 TxHeader  c Server: nginx/1.0.11 
11 TxHeader  c Content-Type: image/jpeg 
11 TxHeader  c Content-Transfer-Encoding: binary 
11 TxHeader  c Cache-Control: must-revalidate 
11 TxHeader  c Content-Length: 125395 
11 TxHeader  c Accept-Ranges: bytes 
11 TxHeader  c Date: Tue, 07 Feb 2012 14:23:00 GMT 
11 TxHeader  c X-Varnish: 479090107 479090015 
11 TxHeader  c Age: 5693 
11 TxHeader  c Via: 1.1 varnish 
11 TxHeader  c Connection: close 
11 Length  c 125395 
11 ReqEnd  c 479090107 1328624580.355833769 1328624580.357449532 0.000084162 0.000103474 0.001512289 
11 SessionClose c Connection: close 
11 StatSess  c XXX.XXX.XXX.XXX 60750 0 1 1 0 0 0 29 
####緩存請求過期VARNISHLOG
12 BackendOpen b live XXX.XXX.XXX.XXX 41945 XXX.XXX.XXX.XXX 80 
12 TxRequest b GET 
12 TxURL  b /image/1156499/1601812475/45010cb14311wq1fd2da042ed599f3ad917005085c400/1181_615/crop 
12 TxProtocol b HTTP/1.1 
12 TxHeader  b Host: URL 
12 TxHeader  b X-Real-IP: XXX.XXX.XXX.XXX 
12 TxHeader  b X-Forwarded-For: XXX.XXX.XXX.XXX 
12 TxHeader  b User-Agent: GraphicalHttpClient 1.0.6 (Macintosh; Mac OS X 10.6.8; en_NL) 
12 TxHeader  b X-Varnish: 479090118 
12 TxHeader  b Accept-Encoding: gzip 
12 RxProtocol b HTTP/1.1 
12 RxStatus  b 200 
12 RxResponse b OK 
12 RxHeader  b Server: nginx/1.0.11 
12 RxHeader  b Date: Tue, 07 Feb 2012 14:26:00 GMT 
12 RxHeader  b Content-Type: image/jpeg 
12 RxHeader  b Connection: keep-alive 
12 RxHeader  b Content-Transfer-Encoding: binary 
12 RxHeader  b Cache-Control: must-revalidate 
12 RxHeader  b Content-Length: 125395 
12 Fetch_Body b 4(length) cls 0 mklen 1 
12 Length  b 125395 
12 BackendReuse b live 
11 SessionOpen c XXX.XXX.XXX.XXX 50429 XXX.XXX.XXX.XXX:2002 
11 ReqStart  c XXX.XXX.XXX.XXX 50429 479090118 
11 RxRequest c GET 
11 RxURL  c /image/1156499/1601812475/45010cb14311wq1fd2da042ed599f3ad917005085c400/1181_615/crop 
11 RxProtocol c HTTP/1.0 
11 RxHeader  c Host: URL 
11 RxHeader  c X-Real-IP: XXX.XXX.XXX.XXX 
11 RxHeader  c X-Forwarded-For: XXX.XXX.XXX.XXX 
11 RxHeader  c Connection: close 
11 RxHeader  c User-Agent: GraphicalHttpClient 1.0.6 (Macintosh; Mac OS X 10.6.8; en_NL) 
11 VCL_call  c recv lookup 
11 VCL_call  c hash 
11 Hash   c /image/1156499/1601812475/45010cb14311wq1fd2da042ed599f3ad917005085c400/1181_615/crop 
11 Hash   c URL 
11 VCL_return c hash 
11 VCL_call  c miss fetch 
11 Backend  c 12 live live 
11 TTL   c 479090118 RFC 120 -1 -1 1328624761 0 1328624760 0 0 
11 VCL_call  c fetch 
11 TTL   c 479090118 VCL 33 -1 -1 1328624758 -3 
11 TTL   c 479090118 VCL 33 40 -1 1328624758 -3 
11 VCL_return c deliver 
11 ObjProtocol c HTTP/1.1 
11 ObjResponse c OK 
11 ObjHeader c Server: nginx/1.0.11 
11 ObjHeader c Date: Tue, 07 Feb 2012 14:26:00 GMT 
11 ObjHeader c Content-Type: image/jpeg 
11 ObjHeader c Content-Transfer-Encoding: binary 
11 ObjHeader c Cache-Control: must-revalidate 
11 VCL_call  c deliver deliver 
11 TxProtocol c HTTP/1.1 
11 TxStatus  c 200 
11 TxResponse c OK 
11 TxHeader  c Server: nginx/1.0.11 
11 TxHeader  c Content-Type: image/jpeg 
11 TxHeader  c Content-Transfer-Encoding: binary 
11 TxHeader  c Cache-Control: must-revalidate 
11 TxHeader  c Content-Length: 125395 
11 TxHeader  c Accept-Ranges: bytes 
11 TxHeader  c Date: Tue, 07 Feb 2012 14:26:00 GMT 
11 TxHeader  c X-Varnish: 479090118 
11 TxHeader  c Age: 0 
11 TxHeader  c Via: 1.1 varnish 
11 TxHeader  c Connection: close 
11 Length  c 125395 
11 ReqEnd  c 479090118 1328624757.532856941 1328624760.899299860 0.000095606 3.364968061 0.001474857 
11 SessionClose c Connection: close 
11 StatSess  c XXX.XXX.XXX.XXX 50429 3 1 1 0 0 1 284 125395 
0 Debug  - "lurker: 0x7f244cfd1e00 30 0" 
+0

由於這清漆郵件列表上已經要求/建議,請檢查您的擴展VCL,看看您的網頁被緩存。如果是這種情況,請提供varnishlog調用的輸出。 – Mojah 2012-02-07 13:49:26

+0

添加了請求的varnislog條目。第一個顯示我很好。第二部分是過期的。該req.grace設爲30秒//該beresp.ttl設爲30秒//該beresp.grace被設置爲40秒 – 2012-02-07 14:31:40

回答

3

這是一個有趣的問題。

從DOC

當幾個客戶端請求相同的頁面上光油將發送 一個請求到後端,並把其他人保持,同時從後端獲取 一個副本。

因此,即使您啓用了寬限期,在任何時間點都會有一個客戶端被阻止。格雷斯告訴Varnish,你可以用陳舊的內容爲所有其他n-1客戶提供服務,直到第一個人回來刷新一些內容爲止。有沒有辦法疏通一個傢伙[技術上採用了異步獲取是不可能的,因爲這種]

看看這個漂亮的article我想你實際上需要的是下一個發行計劃的功能,我希望