Complete the #3354-saga

and also make bereq.bodybytes account only for the actual bytes
in the body, not for the (chunked) overhead.

Ref varnish-cache dc37be044f1954b3c7dd497e3e7a5a06c5a9bc5a

Original patch by Poul-Henning Kamp <phk@FreeBSD.org>
parent a3f19c60
......@@ -744,18 +744,6 @@ at all ESI levels, or not at all.
.. _vsl(7): https://varnish-cache.org/docs/trunk/reference/vsl.html
The size of the response body as reported by Varnish log records with
the ``ReqAcct`` tag (see `vsl(7)`_) may be slightly different for
different deliveries of the same ESI tree, even though the responses
as viewed by a client are identical. This has to do with the way
fragments in the response are transmitted on the wire to clients --
chunked encoding for HTTP/1, and sequences of DATA frames for
HTTP/2. The overhead for these transmission methods is included in the
accounting of ``ReqAcct``. The "chunking" of the response may differ
at different times, depending on the order of events, and on whether
or not we use (partial) sequential delivery (for example, when no
threads are available).
REQUIREMENTS
============
......
......@@ -623,7 +623,7 @@ fini_subreq(struct vdp_ctx *vdx, struct node *node)
AZ(node->subreq.oc);
// need before pesi_destroy
req->acct.resp_bodybytes += VDP_Close(subreq);
(void) VDP_Close(subreq);
/* bottom of cnt_transmit() */
HSH_Cancel(vdx->wrk, subreq->objcore, boc);
......@@ -708,7 +708,7 @@ push_subreq(struct vdp_ctx *vdx, struct bytes_tree *tree,
VSLdbg(vdx, "DeliverObj from top");
VDP_DeliverObj(node->subreq.req);
vdx->req->acct.resp_bodybytes += VDP_Close(node->subreq.req);
node->subreq.req->acct.resp_bodybytes += VDP_Close(node->subreq.req);
// fini_subreq() happening later
......@@ -883,7 +883,7 @@ worklist_push(struct vdp_ctx *vdx, struct bytes_tree *tree,
else if (parent->state < ST_CLOSED)
assert(next == NULL);
else
vdx->req->acct.resp_bodybytes +=
parent->nexus.req->acct.resp_bodybytes +=
VDP_Close(parent->nexus.req);
}
node = next;
......
......@@ -102,7 +102,7 @@ delay 1
logexpect l1 -v v1 -d 1 -g vxid -q "vxid == 1001" {
expect 0 1001 Begin "^req .* rxreq"
expect * = ReqAcct "^29 0 29 202 (104|96) (306|298)$"
expect * = ReqAcct "^29 0 29 202 75 277$"
expect 0 = End
} -run
......@@ -125,9 +125,8 @@ logexpect l4 -v v1 -d 1 -g vxid -q "vxid == 1004" {
logexpect l5 -v v1 -d 1 -g vxid -q "vxid == 1005" {
expect * 1005 Begin "^req .* rxreq"
# ReqAcct body counts include chunked overhead
# Header bytes is 5 larger than in l1 due to two item X-Varnish hdr
expect * = ReqAcct "^29 0 29 207 (104|96) (311|303)$"
expect * = ReqAcct "^29 0 29 207 75 282$"
expect 0 = End
} -run
......
varnishtest "serial processing"
varnishtest "same as e00003.vtc with serial processing"
server s1 {
rxreq
......@@ -50,6 +50,7 @@ varnish v1 -arg "-p debug=+syncvsl" -vcl+backend {
sub vcl_deliver {
pesi.activate();
pesi.set(serial, true);
set resp.http.can_esi = obj.can_esi;
}
} -start
......@@ -58,6 +59,7 @@ client c1 {
rxresp
expect resp.status == 200
expect resp.bodylen == 75
expect resp.http.can_esi == "true"
expect resp.body == {
<html>
Before include
......@@ -74,6 +76,7 @@ client c1 {
rxresp
expect resp.status == 200
expect resp.bodylen == 75
expect resp.http.can_esi == "true"
expect resp.body == {
<html>
Before include
......@@ -95,11 +98,12 @@ client c1 {
client c1 -run
varnish v1 -expect esi_errors == 0
varnish v1 -expect MAIN.s_resp_bodybytes == 150
delay 1
logexpect l1 -v v1 -d 1 -g vxid -q "vxid == 1001" {
expect 0 1001 Begin "^req .* rxreq"
expect * = ReqAcct "^29 0 29 187 (104|96) (291|283)$"
expect * = ReqAcct "^29 0 29 202 75 277$"
expect 0 = End
} -run
......@@ -122,9 +126,8 @@ logexpect l4 -v v1 -d 1 -g vxid -q "vxid == 1004" {
logexpect l5 -v v1 -d 1 -g vxid -q "vxid == 1005" {
expect * 1005 Begin "^req .* rxreq"
# ReqAcct body counts include chunked overhead
# Header bytes is 5 larger than in l1 due to two item X-Varnish hdr
expect * = ReqAcct "^29 0 29 192 (104|96) (296|288)$"
expect * = ReqAcct "^29 0 29 207 75 282$"
expect 0 = End
} -run
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment