You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Colm MacCarthaigh <co...@stdlib.net> on 2004/01/17 13:56:24 UTC

Graceful stop

This has probably been discussed here before, and if it has I'd
like to know the reasons why it's a bad idea. Anyway, I've been
working on a graceful stop mechanism for httpd, which is 
reasonably trivial to work in - the problem is that there are
no portable signal numbers left (or am I wrong in that?) which
means one has to go.

Why does graceful restart exist? Wouldn't it be better to have
a graceful stop, and then just start a new instance?

This would mean;

  * The existing behaviour of a graceful restart would
    be more-or-less preserved, httpd would be restarted
    without dropping clients. Though there would be issues
    with things like mod_perl/php/python persistent variables,
    and maybe a small window where requests are dropped.

  * httpd could be upgraded without dropping clients

That last reason is my reason, right now when I need to upgrade httpd
my only option is to kill httpd to free up port 80, this means kicking
off a few thousand users who are in the middle of some very lengthy
downloads. Since we use off-peak times like the weekend for doing things
like this, this is really bad for dialup users - many of whom leave a
long multi-day download running on a Friday - and arnt amused when they
get back to the office on the Monday to find I killed it.

But basically, graceful stop is trivially doable - it's the behaviour
os most other daemons (things like sshd for example), it allows for
graceful restarts, it allows graceful upgrades.

But then, maybe I'm missing something, please enlighten me :)

-- 
Colm MacCárthaigh                        Public Key: colm+pgp@stdlib.net

Re: Graceful stop

Posted by Colm MacCarthaigh <co...@stdlib.net>.
On Tue, Jan 20, 2004 at 10:17:07AM -0800, Andrew Ho wrote:
> I don't see how this would work--a graceful stop followed by a start would
> mean clients would drop in between the window when you signal the graceful
> stop (and Apache therefore stops accepting new requests) and when the new
> instance starts.

The idea behind a graceful restart is that it won't destroy current
requests, it already adds a delay to serving new requets during the
restart - and frequently drops them (depending on your queue size).

With a graceful stop, and then a start, the outage can be pretty
minimal. Ideally you would have the process issuing the signal to be the
new instance of httpd, so it wait until it's exactly ready to listen()
before calling kill(). I'd wager you'd drop less new connections this
way than the current one, and in any case I think the benifits
of upgradability are much more worth it.

-- 
Colm MacCárthaigh                        Public Key: colm+pgp@stdlib.net


Re: Graceful stop

Posted by Andrew Ho <an...@tellme.com>.
Hello,

CM>Why does graceful restart exist? Wouldn't it be better to have
CM>a graceful stop, and then just start a new instance?
CM>...
CM>  * httpd could be upgraded without dropping clients

I don't see how this would work--a graceful stop followed by a start would
mean clients would drop in between the window when you signal the graceful
stop (and Apache therefore stops accepting new requests) and when the new
instance starts.

Humbly,

Andrew

----------------------------------------------------------------------
Andrew Ho               http://www.tellme.com/       andrew@tellme.com
Engineer                    1-800-555-TELL          Voice 650-930-9062
Tellme Networks, Inc.                                 Fax 650-930-9101
----------------------------------------------------------------------