On Mon, Apr 16, Lukas Tribus wrote:
> On 15 April 2018 at 21:53, Shawn Heisey <hapr...@elyograg.org> wrote:
> > I'm working on making my application capable of handling service restarts on
> > the back end with zero loss or interruption.  It runs on two servers behind
> > haproxy.
> >
> > At application shutdown, I'm setting a flag that makes the healthcheck fail,
> > and then keeping the application running for thirty seconds in order to
> > finish up all requests that the server has already received.
> >
> > It seems that when haproxy's health check fails while a request is underway,
> > the machine making the request will be sent a 502 response instead of the
> > good response that the server WILL make. This is probably a good thing for
> > haproxy to do in general, but in this case, I know that my application's
> > shutdown hook *WILL* allow enough time for the request to finish before it
> > forcibly halts the application.
> You'll have to share you entire configuration for us to be able to
> comment on the behavior.
> Having said that, you'd be better off setting the server to
> maintenance mode instead of letting the health check fail (via
> webinterface or stats socket):
> http://cbonte.github.io/haproxy-dconv/1.5/configuration.html#9.2-set%20server

There's also http-check disable-on-404

So maybe first set flag that returns 404 on health check and only after
thirty seconds fail the health check.


Jarno Huuskonen

Reply via email to