How to find out a single failing backend from a round-robin director?(Inline-C)

Thiago Figueiro TFigueiro at au.westfield.com
Wed Feb 9 22:55:19 CET 2011


(sorry for top-posting)

 

I believe varnishlog has all you need:

 

   54 BackendOpen  b backend_name source_ip source_port dest_ip dest_port

 

Just track the id on the left (54 in this case) for the request and response and you should be able to find the culprit.  

 

 

From: varnish-misc-bounces at varnish-cache.org [mailto:varnish-misc-bounces at varnish-cache.org] On Behalf Of Stefan Pommerening
Sent: Wednesday, 9 February 2011 9:47 PM
To: varnish-misc at varnish-cache.org
Subject: How to find out a single failing backend from a round-robin director?(Inline-C)

 

Hi all,

I'm working with a set of varnish-caches (2.1.3) in front of some round-robin director configured backends.
Sometimes I experience a 503 error due to some unforseeable circumstances like network hiccups, content server problems and other magic...  ;-)
Nevertheless all backends are healthy regarding the large majority of other requests (and watchdog of course), we deal with sporadic failures here.

Obviously I don't want those 503's to go through to the user.

I inserted the following code in my vcl_fetch:

if (beresp.status == 503) {
   set beresp.saintmode = 2s;
   restart;
}

This works quite well, the failed (503 delivering) request is forwarded to the next backend in the director and is successfully served then.

What I am missing is the exact backend information which backend did not serve the request or better said: where did the 503 come from?
I already included some inline-C in order to send info to syslog, but I am missing some VRT_(r_)something to find out the failing backend without searching the backend's logfiles directly.

My current syslog()-msg is:

syslog (LOG_LOCAL7 | LOG_INFO, "VarnishLog(vcl_fetch): %s/%s[%s] [REST=%02d] %s http://%s%s <http://%25s%25s> ", 
   VRT_backend_string(sp), VRT_r_server_hostname(sp), VRT_IP_string(sp,VRT_r_server_ip(sp)), 
   VRT_r_req_restarts(sp), VRT_r_req_request(sp), VRT_GetHdr(sp, HDR_REQ, "\005host:"), VRT_r_req_url(sp));

I managed to get the backend definition, but not the specific backend machine name (or IP) from the backend director.

... and: is there some sort of overview on which VRT_magic fields (for use with inline-C) exists?

Thanks in advance,
Stefan

-- 

Dipl.-Inform. Stefan Pommerening
Informatik-Büro: IT-Dienste & Projekte, Consulting & Coaching
http://www.dmsp.de

 


______________________________________________________
    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).
______________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20110210/66e4720c/attachment-0001.html>


More information about the varnish-misc mailing list