Re: Maintenance mode

From: Alexander Staubo <alex#bengler.no>
Date: Wed, 10 Sep 2008 23:03:55 +0200


Guys, I would like to bring this subject up again. I have not been able to work out a satisfactory solution to the problem.

In a nutshell, when we -- my company -- perform a site update, we want to display a static web page showing the current maintenance state. A site update usually involves taking down all Rails processes, checking out new code, and bringing Rails up again. So while this is going on, HAProxy will attempt, and fail, to connect to its backend servers.

There are a few possible solutions, all of them unsatisfactory:

Now, I have a suggestion for a proper solution, and if Willy likes it I will try my hand at coughing up a patch. The idea is to support user-defined variables that are settable at runtime. In the configuration, these variables would be usable as ACLs:

  frontend http
    ...
    acl variable maintenance_mode true
    use_backend maintenance if maintenance_mode

To control a variable you would invoke the haproxy binary:

  $ haproxy -S maintenance_mode=true

or

  $ haproxy -S maintenance_mode=false

Using shared memory for these variables is probably the easiest, fastest and secure. It would be mapped into HAProxy's local address space, so a lookup is essentially just a local memory read, cheap enough to check on every request. Similarly, read and write access to the variables could then be limited to the HAProxy user, if I remember my POSIX shared memory semantics correctly.

Having such variables at hand would also let you do other tricks not specifically related to maintenance. For example, you can have external monitoring scripts that modify the behaviour of HAProxy based on some sort of load parameter.

Thoughts?

Alexander. Received on 2008/09/10 23:03

This archive was generated by hypermail 2.2.0 : 2008/09/10 23:15 CEST