[PATCH] Expand SLT_Storage with allocation size.

Lasse Karstensen lkarsten at varnish-software.com
Thu Oct 23 16:21:45 CEST 2014


While understanding how fetch_chunksize on chunked backend responses
affect cache size, it was apparent that we don't log anywhere how
much is actually allocated from a stevedore.

This commit introduces two extra fields, header bytes allocated and body
bytes allocated, on the Storage VSL line.
---
 bin/varnishd/cache/cache_obj.c   | 1 +
 bin/varnishd/storage/stevedore.c | 4 ++--
 include/tbl/vsl_tags.h           | 6 ++++--
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/bin/varnishd/cache/cache_obj.c b/bin/varnishd/cache/cache_obj.c
index 73eff9c..53361b7 100644
--- a/bin/varnishd/cache/cache_obj.c
+++ b/bin/varnishd/cache/cache_obj.c
@@ -239,6 +239,7 @@ objallocwithnuke(struct stevedore *stv, struct worker *wrk, size_t size)
 			break;
 	}
 	CHECK_OBJ_ORNULL(st, STORAGE_MAGIC);
+	VSLb(wrk->vsl, SLT_Storage, "%s %s 0 %zu", stv->name, stv->ident, size);
 	return (st);
 }
 
diff --git a/bin/varnishd/storage/stevedore.c b/bin/varnishd/storage/stevedore.c
index 30d8422..53725a4 100644
--- a/bin/varnishd/storage/stevedore.c
+++ b/bin/varnishd/storage/stevedore.c
@@ -282,8 +282,8 @@ STV_NewObject(struct objcore *oc, struct worker *wrk,
 		return (0);
 
 	wrk->stats->n_object++;
-	VSLb(wrk->vsl, SLT_Storage, "%s %s",
-	    oc->stobj->stevedore->name, oc->stobj->stevedore->ident);
+	VSLb(wrk->vsl, SLT_Storage, "%s %s %i 0",
+	    oc->stobj->stevedore->name, oc->stobj->stevedore->ident, ltot);
 	return (1);
 }
 
diff --git a/include/tbl/vsl_tags.h b/include/tbl/vsl_tags.h
index b483f2c..8ae7193 100644
--- a/include/tbl/vsl_tags.h
+++ b/include/tbl/vsl_tags.h
@@ -419,8 +419,10 @@ SLTM(VSL, 0, "VSL API warnings and error message",
 SLTM(Storage, 0, "Where object is stored",
 	"Type and name of the storage backend the object is stored in.\n\n"
 	"The format is::\n\n"
-	"\t%s %s\n"
-	"\t|  |\n"
+	"\t%s %s %d %d\n"
+	"\t|  |  |  |\n"
+	"\t|  |  |  +- Body bytes allocated\n"
+	"\t|  |  +- Header bytes allocated\n"
 	"\t|  +- Name of storage backend\n"
 	"\t+---- Type (\"malloc\", \"file\", \"persistent\" etc.)\n"
 	"\n"
-- 
2.1.1


-- 
Lasse Karstensen
Varnish Software AS



More information about the varnish-dev mailing list