r4231 - in trunk/varnish-cache: bin/varnishd include

phk at projects.linpro.no phk at projects.linpro.no
Tue Sep 8 13:35:40 CEST 2009


Author: phk
Date: 2009-09-08 13:35:39 +0200 (Tue, 08 Sep 2009)
New Revision: 4231

Modified:
   trunk/varnish-cache/bin/varnishd/cache_fetch.c
   trunk/varnish-cache/include/stat_field.h
Log:
Add a family of 9 counters to tell us how fetching from the backends
progress.



Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_fetch.c	2009-09-08 11:32:10 UTC (rev 4230)
+++ trunk/varnish-cache/bin/varnishd/cache_fetch.c	2009-09-08 11:35:39 UTC (rev 4231)
@@ -428,14 +428,17 @@
 	cls = 0;
 	mklen = 0;
 	if (is_head) {
-		/* nothing */
+		sp->wrk->stats.fetch_head++;
 	} else if (http_GetHdr(hp, H_Content_Length, &b)) {
+		sp->wrk->stats.fetch_length++;
 		cls = fetch_straight(sp, sp->wrk->htc, b);
 		mklen = 1;
 	} else if (http_HdrIs(hp, H_Transfer_Encoding, "chunked")) {
+		sp->wrk->stats.fetch_chunked++;
 		cls = fetch_chunked(sp, sp->wrk->htc);
 		mklen = 1;
 	} else if (http_GetHdr(hp, H_Transfer_Encoding, &b)) {
+		sp->wrk->stats.fetch_bad++;
 		/* XXX: AUGH! */
 		WSL(sp->wrk, SLT_Debug, vc->fd, "Invalid Transfer-Encoding");
 		VBE_ClosedFd(sp);
@@ -448,6 +451,7 @@
 		 */
 		mklen = 1;
 	} else if (http_HdrIs(hp, H_Connection, "close")) {
+		sp->wrk->stats.fetch_close++;
 		/*
 		 * If we have connection closed, it is safe to read what
 		 * comes in any case.
@@ -455,19 +459,23 @@
 		cls = fetch_eof(sp, sp->wrk->htc);
 		mklen = 1;
 	} else if (hp->protover < 1.1) {
+		sp->wrk->stats.fetch_oldhttp++;
 		/*
 		 * With no Connection header, assume EOF
 		 */
 		cls = fetch_eof(sp, sp->wrk->htc);
 		mklen = 1;
 	} else {
+		sp->wrk->stats.fetch_zero++;
 		/*
 		 * Assume zero length
+		 * XXX:  ??? 
 		 */
 		mklen = 1;
 	}
 
 	if (cls < 0) {
+		sp->wrk->stats.fetch_failed++;
 		/* XXX: Wouldn't this store automatically be released ? */
 		while (!VTAILQ_EMPTY(&sp->obj->store)) {
 			st = VTAILQ_FIRST(&sp->obj->store);

Modified: trunk/varnish-cache/include/stat_field.h
===================================================================
--- trunk/varnish-cache/include/stat_field.h	2009-09-08 11:32:10 UTC (rev 4230)
+++ trunk/varnish-cache/include/stat_field.h	2009-09-08 11:35:39 UTC (rev 4231)
@@ -49,6 +49,17 @@
 MAC_STAT(backend_recycle,	uint64_t, 0, 'a', "Backend conn. recycles")
 MAC_STAT(backend_unused,	uint64_t, 0, 'a', "Backend conn. unused")
 
+MAC_STAT(fetch_head,		uint64_t, 1, 'a', "Fetch head")
+MAC_STAT(fetch_length,		uint64_t, 1, 'a', "Fetch with Length")
+MAC_STAT(fetch_chunked,		uint64_t, 1, 'a', "Fetch chunked")
+MAC_STAT(fetch_eof,		uint64_t, 1, 'a', "Fetch EOF")
+MAC_STAT(fetch_bad,		uint64_t, 1, 'a', "Fetch had bad headers")
+MAC_STAT(fetch_close,		uint64_t, 1, 'a', "Fetch wanted close")
+MAC_STAT(fetch_oldhttp,		uint64_t, 1, 'a', "Fetch pre HTTP/1.1 closed")
+MAC_STAT(fetch_zero,		uint64_t, 1, 'a', "Fetch zero len")
+MAC_STAT(fetch_failed,		uint64_t, 1, 'a', "Fetch failed")
+
+
 MAC_STAT(n_sess_mem,		uint64_t, 0, 'i', "N struct sess_mem")
 MAC_STAT(n_sess,		uint64_t, 0, 'i', "N struct sess")
 MAC_STAT(n_object,		uint64_t, 1, 'i', "N struct object")



More information about the varnish-commit mailing list