Introducing backend healthchecking plugin

Jack Lindamood jack at facebook.com
Sat Feb 27 04:24:55 MSK 2010


I've written a plugin that can health check nginx backends, which everyone is free to use.  This is similar to the healthchecking features that varnish and haproxy support.  Here's a sample config[1] just to give you an idea, that uses the upstream_hash plugin.  You can get the code here [2] and an example of how to patch upstream_hash here [3].  The plugin is actually an optional feature that other upstream plugins, like upstream fair or iphash for example, can plug into and use.  To use it, their code needs to be modified to also check the health of the backend.

This plugin is super beta, so please be careful.  Feedback/patches welcome.


[1]
  upstream test_upstreams {
    server localhost:11114;
    server localhost:11115;

    hash $filename;
    hash_again 10;
    healthcheck_enabled;
    healthcheck_delay 1000;
    healthcheck_timeout 1000;
    healthcheck_failcount 1;
    healthcheck_expected 'I_AM_ALIVE';
    healthcheck_send "GET /health HTTP/1.1" 'Host: www.mysite.com' 'Connection: close';
  }

[2]
http://github.com/cep21/healthcheck_nginx_upstreams
[3]
http://github.com/cep21/nginx_upstream_hash/tree/support_http_healthchecks




More information about the nginx mailing list