[PATCH] Initial backend health

Ken Brownfield kb+varnish at slide.com
Fri Jun 19 08:20:38 CEST 2009


[Apologies if this belongs on varnish-dev; this list seemed much more  
active.]

This patch came about from observations in tickets #512 and #518.

The attached patch creates a backend flag to change the initial health  
of backends upon varnishd startup:

backend foo {
	.initial_health = 1;
}

The backend healthy flag internally is an unsigned int, so I kept the  
same type.  A value > 0 here will cause this backend to default to  
healthy.  Also, the initial "Probe" output at startup will note  
"initially healthy" if this flag is set.

The backend will immediately go "sick" if a single health check  
fails*, until the window is flushed.  This seems like the safest way  
to implement this option, since a bad host will only receive hits  
until the first probe can execute against it, which in my testing was  
nearly immediate.  Healthy hosts will continue to pass and stay healthy.

I'm not using probed backends in production right now, but I'm running  
one instance of the patched version at ~1,000 requests per second (at  
8% of a single 2.5G Xeon) and it's stable.  YMMV, protect yourself, etc.

I thought about having this flag apply to the director, and backends  
would inherit this central flag...  but while setting this for every  
backend in the config is a little verbose, it just seems cleaner,  
conceptually.  And a per-backend setting seems cleaner and more  
flexible than a command-line flag.

TODO: I should probably add "-p initial_health=1", as it fits the  
defaults like between_bytes_timeout.

Comments?  Thoughts?
-- 
Ken.

*(I'm marking the "oldest" .threshold probes in the .window as "pass"  
and the others "fail", so a single probe fail will cause sickness  
until the window has flushed. The BITMAP()/vt->happy stuff in bin/ 
varnishd/cache_backend_poll.[ch] made my face bleed, but look there  
for specifics of the implementation.)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: varnish-kb0.patch
Type: application/octet-stream
Size: 2542 bytes
Desc: not available
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20090618/e9d5c1d0/attachment-0003.obj>


More information about the varnish-misc mailing list