Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P6970
vcl_hit-deliver-keep.vtc
Active
Public
Actions
Authored by
•
ema
on Apr 9 2018, 2:43 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F16866138:
Apr 9 2018, 3:01 PM
2018-04-09 15:01:46 (UTC+0)
F16866085:
Apr 9 2018, 2:55 PM
2018-04-09 14:55:38 (UTC+0)
F16866032:
Apr 9 2018, 2:43 PM
2018-04-09 14:43:11 (UTC+0)
Subscribers
None
varnishtest "return deliver in vcl_hit (using keep)"
server s1 {
rxreq
txresp -hdr "Cache-Control: s-maxage=2" -hdr "Last-Modified: Tue, 03 Apr 2018 21:35:51 +0200" -hdr "X-Resp-ID: 1"
rxreq
txresp -hdr "Cache-Control: s-maxage=2" -hdr "Last-Modified: Tue, 03 Apr 2018 21:35:51 +0200" -hdr "X-Resp-ID: 2"
} -start
varnish v1 -vcl+backend {
sub vcl_backend_response {
set beresp.grace = 0s;
set beresp.keep = 5s;
}
sub vcl_hit {
return(deliver);
}
} -start
# First request, cache miss
client c1 {
txreq
rxresp
expect resp.http.X-Resp-ID == 1
} -run
varnish v1 -expect cache_hit == 0
varnish v1 -expect cache_miss == 1
# Second request, cache hit
client c2 {
txreq
rxresp
expect resp.http.X-Resp-ID == 1
} -run
varnish v1 -expect cache_hit == 1
varnish v1 -expect cache_miss == 1
# Third request waiting 3s to make the 2s ttl expire. This will result in a
# bgfetch and the stale object being returned. Still considered a cache hit.
client c3 {
delay 3
txreq
rxresp
expect resp.http.X-Resp-ID == 1
} -run
varnish v1 -expect cache_hit == 2
varnish v1 -expect cache_miss == 1
# Fourth request. This one returns the second object and is considered
# a cache hit as well.
client c4 {
txreq
rxresp
expect resp.http.X-Resp-ID == 2
} -run
varnish v1 -expect cache_hit == 3
varnish v1 -expect cache_miss == 1
varnish v1 -expect n_expired == 0
Event Timeline
•
ema
created this paste.
Apr 9 2018, 2:43 PM
2018-04-09 14:43:11 (UTC+0)
•
ema
edited the content of this paste.
(Show Details)
Apr 9 2018, 2:55 PM
2018-04-09 14:55:38 (UTC+0)
•
ema
edited the content of this paste.
(Show Details)
Apr 9 2018, 3:01 PM
2018-04-09 15:01:46 (UTC+0)
•
ema
changed the title of this paste from untitled to
vcl_hit-deliver-keep.vtc
.
Apr 17 2018, 2:25 PM
2018-04-17 14:25:34 (UTC+0)
Log In to Comment