如何在获取过期对象或最大对象期间提供旧对象 连接?
我在vcl_recv中将宽限期配置为vcl_fetch。
我甚至尝试使用圣模式给我一个“3”缓存对象。
有人可以帮我解决这个问题吗?
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);
}
#### CACHE REQUEST 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
#### CACHE REQUEST EXPIRED 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 :(得分:3)
这是一个有趣的问题。
来自DOC
当多个客户请求同一页面时,Varnish将发送 一个请求后端并在获取时将其他人置于保持状态 来自后端的一份副本。
因此,即使你启用了恩典,任何时候都会有一个客户端被阻止。 Grace通知Varnish你可以为所有其他n-1客户提供过时的内容,直到第一个人回来时有一些内容要刷新。没有办法解锁那个人[技术上异步提取是不可能的]
看看这个好article我认为你实际要求的是下一个版本的计划功能我希望