[PATCH 17/25] Add a run-time parameter for stream fetch thread grab timeout.

Martin Blix Grydeland martin at varnish-software.com
Sun Jan 22 18:53:23 CET 2012


---
 bin/varnishd/cache/cache_center.c |    4 +---
 bin/varnishd/common/params.h      |    1 +
 bin/varnishd/mgt/mgt_param.c      |    6 ++++++
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/bin/varnishd/cache/cache_center.c b/bin/varnishd/cache/cache_center.c
index 23b5f71..aaab4fd 100644
--- a/bin/varnishd/cache/cache_center.c
+++ b/bin/varnishd/cache/cache_center.c
@@ -1041,9 +1041,7 @@ cnt_streambody(struct sess *sp, struct worker *wrk, struct req *req)
 		wrk->busyobj->fetch_obj = req->obj;
 		http_Setup(wrk->busyobj->bereq, NULL);
 		http_Setup(wrk->busyobj->beresp, NULL);
-		wrk_ex = SES_GrabWorker(sp, 100); /* MBGXXX: Configurable
-						   * thread grabbing
-						   * timeout */
+		wrk_ex = SES_GrabWorker(sp, cache_param->stream_grab_timeout);
 		if (wrk_ex != NULL)
 			wrk->busyobj->use_locks = 1;
 		if (req->obj->objcore != NULL) {
diff --git a/bin/varnishd/common/params.h b/bin/varnishd/common/params.h
index f0445ae..f726ce8 100644
--- a/bin/varnishd/common/params.h
+++ b/bin/varnishd/common/params.h
@@ -99,6 +99,7 @@ struct params {
 	ssize_t			fetch_chunksize;
 	ssize_t			fetch_maxchunksize;
 	ssize_t			stream_maxchunksize;
+	unsigned		stream_grab_timeout;
 	unsigned		nuke_limit;
 
 #ifdef SENDFILE_WORKS
diff --git a/bin/varnishd/mgt/mgt_param.c b/bin/varnishd/mgt/mgt_param.c
index 227ea3a..9b1467f 100644
--- a/bin/varnishd/mgt/mgt_param.c
+++ b/bin/varnishd/mgt/mgt_param.c
@@ -846,6 +846,12 @@ static const struct parspec input_parspec[] = {
 		"data available.\n",
 		EXPERIMENTAL,
 		"256k", "bytes" },
+	{ "stream_grab_timeout",
+		tweak_uint, &mgt_param.stream_grab_timeout, 0, UINT_MAX,
+		"Wait at most this long for an idle worker to appear when "
+		"grabbing a thread for background fetch.\n",
+		EXPERIMENTAL,
+		"100", "milliseconds" },
 #ifdef SENDFILE_WORKS
 	{ "sendfile_threshold",
 		tweak_bytes, &mgt_param.sendfile_threshold, 0, HUGE_VAL,
-- 
1.7.4.1




More information about the varnish-dev mailing list