[PATCH] Don't keep object contents around for hit-for-pass after delivering

Rogier 'DocWilco' Mulhuijzen github at bsdchicks.com
Wed Feb 22 06:42:33 CET 2012


So, while going over various things, we discovered that hit-for-pass
objects actually keep the content around as well. We found that to be
an enormous waste of space, and decided to do something about it.

Namely:

---
 bin/varnishd/cache/cache_center.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/bin/varnishd/cache/cache_center.c b/bin/varnishd/cache/cache_center.c
index b6ee5a5..cfe2619 100644
--- a/bin/varnishd/cache/cache_center.c
+++ b/bin/varnishd/cache/cache_center.c
@@ -333,6 +333,13 @@ cnt_deliver(struct sess *sp, struct worker *wrk, struct req *req)
 	req->restarts = 0;
 
 	RES_WriteObj(sp);
+	
+	CHECK_OBJ_NOTNULL(req->obj, OBJECT_MAGIC);
+	if (req->obj->objcore != NULL) {
+		CHECK_OBJ_NOTNULL(req->obj->objcore, OBJCORE_MAGIC);
+		if (req->obj->objcore->flags & OC_F_PASS)
+			STV_Freestore(req->obj);
+	}
 
 	assert(WRW_IsReleased(wrk));
 	(void)HSH_Deref(&wrk->stats, NULL, &req->obj);
-- 
1.7.5.4




More information about the varnish-dev mailing list