[experimental-ims] 4670e05 Add a couple of counters to keep track of how many requests are on the busy-obj waitinglists

Poul-Henning Kamp phk at FreeBSD.org
Thu Dec 18 10:27:53 CET 2014


commit 4670e0541e9559239c6f9aa360385ef45dc2928a
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Aug 13 10:43:38 2012 +0000

    Add a couple of counters to keep track of how many requests
    are on the busy-obj waitinglists

diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c
index abcb4c0..fd0bbe1 100644
--- a/bin/varnishd/cache/cache_hash.c
+++ b/bin/varnishd/cache/cache_hash.c
@@ -424,6 +424,8 @@ HSH_Lookup(struct req *req)
 		if (cache_param->diag_bitmap & 0x20)
 			VSLb(req->vsl, SLT_Debug,
 				"on waiting list <%p>", oh);
+
+		wrk->stats.busy_sleep++;
 		SES_Charge(req->wrk, req);
 		/*
 		 * The objhead reference transfers to the sess, we get it
@@ -480,6 +482,7 @@ hsh_rush(struct dstat *ds, struct objhead *oh)
 		if (req == NULL)
 			break;
 		CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
+		ds->busy_wakeup++;
 		AZ(req->wrk);
 		VTAILQ_REMOVE(&wl->list, req, w_list);
 		DSL(0x20, SLT_Debug, req->sp->vsl_id, "off waiting list");
diff --git a/bin/varnishtest/tests/c00013.vtc b/bin/varnishtest/tests/c00013.vtc
index fee1271..a79244b 100644
--- a/bin/varnishtest/tests/c00013.vtc
+++ b/bin/varnishtest/tests/c00013.vtc
@@ -33,3 +33,6 @@ client c2 {
 } -run
 
 client c1 -wait
+
+varnish v1 -expect busy_sleep == 1
+varnish v1 -expect busy_wakeup == 1
diff --git a/include/tbl/vsc_f_main.h b/include/tbl/vsc_f_main.h
index c3fd288..d9c78ce 100644
--- a/include/tbl/vsc_f_main.h
+++ b/include/tbl/vsc_f_main.h
@@ -249,6 +249,18 @@ VSC_F(thread_queue_len,		uint64_t, 0, 'g',
 	"  See also param queue_max."
 )
 
+VSC_F(busy_sleep,		uint64_t, 1, 'c',
+    "Number of requests sent to sleep on busy objhdr",
+	"Number of requests sent to sleep without a worker threads because"
+	" they found a busy object."
+)
+
+VSC_F(busy_wakeup,		uint64_t, 1, 'c',
+    "Number of requests woken after sleep on busy objhdr",
+	"Number of requests taken of the busy object sleep list and"
+	" and rescheduled."
+)
+
 VSC_F(sess_queued,		uint64_t, 0, 'c',
     "Sessions queued for thread",
 	"Number of times session was queued waiting for a thread."



More information about the varnish-commit mailing list