From 8a249984c24158d68507b329db94fe0feca7775c Mon Sep 17 00:00:00 2001 From: phk Date: Tue, 26 Aug 2008 09:47:49 +0000 Subject: [PATCH] Tada! First step in activating backend polling: Do not attempt to open connections to a unhealthy backend. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3132 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_backend.c | 5 +++++ varnish-cache/include/stat_field.h | 1 + 2 files changed, 6 insertions(+) diff --git a/varnish-cache/bin/varnishd/cache_backend.c b/varnish-cache/bin/varnishd/cache_backend.c index 49672141..53afab0c 100644 --- a/varnish-cache/bin/varnishd/cache_backend.c +++ b/varnish-cache/bin/varnishd/cache_backend.c @@ -313,6 +313,11 @@ VBE_GetVbe(struct sess *sp, struct backend *bp) VBE_ClosedFd(sp); } + if (!bp->healthy) { + VSL_stats->backend_unhealthy++; + return (NULL); + } + vc = VBE_NewConn(); assert(vc->fd == -1); AZ(vc->backend); diff --git a/varnish-cache/include/stat_field.h b/varnish-cache/include/stat_field.h index b46e26c1..86f7b678 100644 --- a/varnish-cache/include/stat_field.h +++ b/varnish-cache/include/stat_field.h @@ -37,6 +37,7 @@ MAC_STAT(cache_hitpass, uint64_t, 'a', "Cache hits for pass") MAC_STAT(cache_miss, uint64_t, 'a', "Cache misses") MAC_STAT(backend_conn, uint64_t, 'a', "Backend connections success") +MAC_STAT(backend_unhealthy, uint64_t, 'a', "Backend connections not attempted") MAC_STAT(backend_fail, uint64_t, 'a', "Backend connections failures") MAC_STAT(backend_reuse, uint64_t, 'a', "Backend connections reuses") MAC_STAT(backend_recycle, uint64_t, 'a', "Backend connections recycles") -- 2.39.5