[PATCH] Tickle old, idle workers to give up their VCLs

Tollef Fog Heen tfheen at varnish-software.com
Wed Feb 20 10:51:01 CET 2013


---

 bin/varnishd/cache/cache_pool.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/bin/varnishd/cache/cache_pool.c b/bin/varnishd/cache/cache_pool.c
index 4e7bd7c..c19c1fe 100644
--- a/bin/varnishd/cache/cache_pool.c
+++ b/bin/varnishd/cache/cache_pool.c
@@ -364,6 +364,16 @@ pool_herder(void *priv)
 			continue;
 		}
 
+		Lck_Lock(&pp->mtx);
+		VTAILQ_FOREACH_REVERSE(pt, &pp->idle_queue, taskhead, list) {
+			CAST_OBJ_NOTNULL(wrk, pt->priv, WORKER_MAGIC);
+			if (wrk->lastused > t_idle)
+				break;
+			if (wrk->vcl != NULL)
+				VCL_Rel(&wrk->vcl);
+		}
+		Lck_Unlock(&pp->mtx);
+
 		if (pp->nthr > cache_param->wthread_min) {
 
 			t_idle = VTIM_real() - cache_param->wthread_timeout;
-- 
1.7.10.4




More information about the varnish-dev mailing list