Hash director and backend health

KT Sin sinkeyteck at yahoo.com
Mon Aug 1 08:08:25 CEST 2011


the hash director will fail if all the backends are failing. if you
define a random director with the same set of backends, and if the hash
director fails, the random director fails too?

kt

On Mon, Aug 01, 2011 at 05:44:01AM +0000, Thiago Figueiro wrote:
> Hi, all.
> 
> I'm experimenting with the hash director but the current documentation[1] is brief and I need some help. (background: our application servers do some local fragment caching and this is more efficient if the URLs go to servers which already have the necessary fragments).
> 
> As desired, the hash director is selecting the same backend for a given URL.  However, when the backend goes sick, I expect varnish to pick a healthy one; instead I get a 503 due to no backend available.
> 
> This is the backend definition:
> 
> director example hash {
> 	.retries = 5;
>         { .backend = server1; .weight = 1; }
> (...)
>         { .backend = server8; .weight = 1; }
> }
> 
> I assumed the "retries" parameter in the director definition would try different backends; it might be that it retries the same backend.
> 
> It could be relevant that my vcl_fetch has:
> 
> sub vcl_fetch {
> (...)
>         # If status not one of the below try again (up to max_restarts)
>         if (
>         beresp.status != 200 && beresp.status != 403 && beresp.status != 404 &&
>         beresp.status != 301 && beresp.status != 302 && beresp.status != 307 &&
>         beresp.status != 410) {
>                 if (req.http.X-Forwarded-Host) {
>                          set req.http.Host = req.http.X-Forwarded-Host;
>                 }
> 
>                 restart;
>         }
> 
> 
> To overcome this I thought about defining a random director with the same set of servers and, should the hash director fail, I'd update req.backend to use the random director.  I don't like this too much because it would double the number of health checks, which are not exactly cheap, and I would need to complicate the VCL a bit more.
> 
> Am I missing something?  Is there a better way of handling this situation?
> 
> 
> Thanks.
> 
> 
> [1] https://www.varnish-cache.org/docs/2.1/reference/vcl.html#the-hash-director
> ? 
> 
> Thiago Figueiro
> Technical Operations Manager
> 
> Westfield Digital Business
> T +61 (0)2 9358 7123
> M +61 (0)405 700 814
> W www.westfield.com.au
> E tfigueiro at au.westfield.com
> 
> 
> 
> 
> 
> 
> ______________________________________________________
>     CONFIDENTIALITY NOTICE    
> This electronic mail message, including any and/or all attachments, is for the sole use of the intended recipient(s), and may contain confidential and/or privileged information, pertaining to business conducted under the direction and supervision of the sending organization. All electronic mail messages, which may have been established as expressed views and/or opinions (stated either within the electronic mail message or any of its attachments), are left to the sole responsibility of that of the sender, and are not necessarily attributed to the sending organization. Unauthorized interception, review, use, disclosure or distribution of any such information contained within this electronic mail message and/or its attachment(s), is (are) strictly prohibited. If you are not the intended recipient, please contact the sender by replying to this electronic mail message, along with the destruction all copies of the original electronic mail message (along with any attachments).
> ______________________________________________________
> 
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc




More information about the varnish-misc mailing list