Skip to content

Instantly share code, notes, and snippets.

@rezan
Created July 6, 2020 18:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rezan/7cec718d8ef31834eeeac86fd65ae81c to your computer and use it in GitHub Desktop.
Save rezan/7cec718d8ef31834eeeac86fd65ae81c to your computer and use it in GitHub Desktop.
varnishscoreboard parallel ESI
varnishtest "varnishscoreboard parallel ESI"
barrier b1 cond 3
barrier b2 cond 3
server s1 {
rxreq
txresp -body {
<esi:include src="/c1"/>
<esi:include src="/c2"/>
}
expect req.url == "/parent"
rxreq
expect req.url == "/c1"
barrier b1 sync
barrier b2 sync
txresp -body s1
} -start
server s2 {
rxreq
expect req.url == "/c2"
barrier b1 sync
barrier b2 sync
txresp -body s2
} -start
varnish v1 -cliok "param.set thread_pool_track on" -vcl+backend {
sub vcl_backend_fetch {
if (bereq.url == "/c2") {
set bereq.backend = s2;
}
}
sub vcl_backend_response {
set beresp.do_esi = true;
}
} -start
client c1 {
txreq -url /parent -hdr "Host: esi"
rxresp
expect resp.body ~ s1
expect resp.body ~ s2
} -start
barrier b1 sync
shell -match "GET esi /c1" {
varnishscoreboard -n ${v1_name}
}
shell -match "GET esi /c2" {
varnishscoreboard -n ${v1_name}
}
shell -match "GET esi /parent" {
varnishscoreboard -n ${v1_name}
}
barrier b2 sync
client c1 -wait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment