[master] 7bf932f3a Rename the esi_iovs paramter to http1_iovs and default it to 64 which is half the wrk-aws it comes from.

Poul-Henning Kamp phk at FreeBSD.org
Mon Oct 15 20:18:09 UTC 2018


commit 7bf932f3a674fa934c1bfd586686686003eec550
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Oct 15 19:16:30 2018 +0000

    Rename the esi_iovs paramter to http1_iovs and default it to 64
    which is half the wrk-aws it comes from.
    
    This saves us from peeking into the VDP stack to spot ESI modules.

diff --git a/bin/varnishd/http1/cache_http1_deliver.c b/bin/varnishd/http1/cache_http1_deliver.c
index c0fce16d3..580a23e37 100644
--- a/bin/varnishd/http1/cache_http1_deliver.c
+++ b/bin/varnishd/http1/cache_http1_deliver.c
@@ -84,7 +84,7 @@ v1d_error(struct req *req, const char *msg)
 void v_matchproto_(vtr_deliver_f)
 V1D_Deliver(struct req *req, struct boc *boc, int sendbody)
 {
-	int err;
+	int err = 0;
 	unsigned u;
 	uint64_t hdrbytes, bytes;
 
@@ -131,7 +131,7 @@ V1D_Deliver(struct req *req, struct boc *boc, int sendbody)
 
 	AZ(req->wrk->v1l);
 	V1L_Open(req->wrk, req->wrk->aws,
-		 &req->sp->fd, req->vsl, req->t_prev, 0);
+		 &req->sp->fd, req->vsl, req->t_prev, cache_param->http1_iovs);
 
 	if (WS_Overflowed(req->wrk->aws)) {
 		v1d_error(req, "workspace_thread overflow");
@@ -141,47 +141,18 @@ V1D_Deliver(struct req *req, struct boc *boc, int sendbody)
 
 	hdrbytes = HTTP1_Write(req->wrk, req->resp, HTTP1_Resp);
 
-	if (!sendbody || req->res_mode & RES_ESI) {
-		if (V1L_Close(req->wrk, &bytes) && req->sp->fd >= 0) {
-			Req_Fail(req, SC_REM_CLOSE);
-			sendbody = 0;
-		}
-
-		/* Charge bytes sent as reported from V1L_Close. Only
-		 * header-bytes have been attempted sent. */
-		req->acct.resp_hdrbytes += bytes;
-		hdrbytes = 0;
-	} else if (DO_DEBUG(DBG_FLUSH_HEAD))
-		(void)V1L_Flush(req->wrk);
-
-	if (!sendbody) {
-		AZ(req->wrk->v1l);
-		VDP_close(req);
-		return;
-	}
-
-	AN(sendbody);
-	if (req->res_mode & RES_ESI) {
-		AZ(req->wrk->v1l);
-
-		V1L_Open(req->wrk, req->wrk->aws,
-			 &req->sp->fd, req->vsl, req->t_prev,
-			 cache_param->esi_iovs);
-
-		if (WS_Overflowed(req->wrk->aws)) {
-			v1d_error(req, "workspace_thread overflow");
-			AZ(req->wrk->v1l);
-			return;
-		}
+	if (sendbody) {
+		if (DO_DEBUG(DBG_FLUSH_HEAD))
+			(void)V1L_Flush(req->wrk);
+		if (req->res_mode & RES_CHUNKED)
+			V1L_Chunked(req->wrk);
+		err = VDP_DeliverObj(req);
+		if (!err && (req->res_mode & RES_CHUNKED))
+			V1L_EndChunk(req->wrk);
 	}
 
-	if (req->res_mode & RES_CHUNKED)
-		V1L_Chunked(req->wrk);
-	err = VDP_DeliverObj(req);
-	if (!err && (req->res_mode & RES_CHUNKED))
-		V1L_EndChunk(req->wrk);
-
 	u = V1L_Close(req->wrk, &bytes);
+	AZ(req->wrk->v1l);
 
 	/* Bytes accounting */
 	if (bytes < hdrbytes)
@@ -193,6 +164,5 @@ V1D_Deliver(struct req *req, struct boc *boc, int sendbody)
 
 	if ((u || err) && req->sp->fd >= 0)
 		Req_Fail(req, SC_REM_CLOSE);
-	AZ(req->wrk->v1l);
 	VDP_close(req);
 }
diff --git a/doc/sphinx/whats-new/upgrading-6.0.rst b/doc/sphinx/whats-new/upgrading-6.0.rst
index 2006a97b1..7dcf0850c 100644
--- a/doc/sphinx/whats-new/upgrading-6.0.rst
+++ b/doc/sphinx/whats-new/upgrading-6.0.rst
@@ -123,7 +123,7 @@ taken from :ref:`ref_param_workspace_client`. If you need to reduce
 memory footprint, consider reducing ``workspace_client`` by the amount
 in ``workspace_thread``.
 
-Added :ref:`ref_param_esi_iovs`. tl;dr: Don't touch it, unless advised
+Added `ref_param_esi_iovs`. tl;dr: Don't touch it, unless advised
 to do so by someone familiar with the innards of Varnish.
 
 Changes to VCL
diff --git a/include/tbl/params.h b/include/tbl/params.h
index 7bebdeb4b..f1703613c 100644
--- a/include/tbl/params.h
+++ b/include/tbl/params.h
@@ -498,16 +498,17 @@ PARAM(
 )
 
 PARAM(
-	/* name */	esi_iovs,
+	/* name */	http1_iovs,
 	/* typ */	uint,
-	/* min */	"3",
-	/* max */	"1024",	// XXX stringify IOV_MAX
-	/* default */	"10",		// 5 should suffice, add headroom
-	/* units */	"struct iovec",
+	/* min */	"5",
+	/* max */	"1024",		// XXX stringify IOV_MAX
+	/* default */	"64",
+	/* units */	"struct iovec (=16 bytes)",
 	/* flags */	WIZARD,
 	/* s-text */
-	"Number of io vectors to allocate on the thread workspace for "
-	"ESI requests.",
+	"Number of io vectors to allocate for HTTP1 protocol transmission."
+	"  A HTTP1 header needs 7 + 2 per HTTP header field."
+	"  Allocated from workspace_thread.",
 	/* l-text */	"",
 	/* func */	NULL
 )


More information about the varnish-commit mailing list