[master] dd5b7056a fetch: New debug::slow_bereq flag

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Wed Jul 3 09:39:05 UTC 2024


commit dd5b7056a647f53708acd02d33ff03f3bb85d305
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Fri Apr 8 19:29:37 2022 +0200

    fetch: New debug::slow_bereq flag
    
    It is otherwise very challenging to coordinate certain behaviors between
    a backend fetch and a VTC server for example. The slow_acceptor delay is
    2s, which is probably more than needed for a bereq, hence the 1s delay.

diff --git a/bin/varnishd/http1/cache_http1_fetch.c b/bin/varnishd/http1/cache_http1_fetch.c
index 5ea77b936..4ea37e1d3 100644
--- a/bin/varnishd/http1/cache_http1_fetch.c
+++ b/bin/varnishd/http1/cache_http1_fetch.c
@@ -54,6 +54,8 @@ vbf_iter_req_body(void *priv, unsigned flush, const void *ptr, ssize_t l)
 	CAST_OBJ_NOTNULL(bo, priv, BUSYOBJ_MAGIC);
 
 	if (l > 0) {
+		if (DO_DEBUG(DBG_SLOW_BEREQ))
+			VTIM_sleep(1.0);
 		(void)V1L_Write(bo->wrk, ptr, l);
 		if (flush && V1L_Flush(bo->wrk) != SC_NULL)
 			return (-1);
diff --git a/include/tbl/debug_bits.h b/include/tbl/debug_bits.h
index 0e60d2547..869399a6f 100644
--- a/include/tbl/debug_bits.h
+++ b/include/tbl/debug_bits.h
@@ -52,6 +52,7 @@ DEBUG_BIT(PROCESSORS,		processors,	"Fetch/Deliver processors")
 DEBUG_BIT(PROTOCOL,		protocol,	"Protocol debugging")
 DEBUG_BIT(VCL_KEEP,		vcl_keep,	"Keep VCL C and so files")
 DEBUG_BIT(LCK,			lck,		"Additional lock statistics")
+DEBUG_BIT(SLOW_BEREQ,		slow_bereq,	"Slow down bereq")
 #undef DEBUG_BIT
 
 /*lint -restore */


More information about the varnish-commit mailing list