Page 1 of 1

Graceful upgrades?

Posted: Tue Jul 06, 2010 10:40 am
by alex.barylski
I'm wondering, when you update a software system which is actively in use, how do you ensure all requests prior shutdown are allowed to continue to completion?

Code: Select all

apache2ctl graceful
Or do you use another technique?

It's to my understanding that all pending requests are finished before the server goes down, so if someone executes an action which takes a few seconds to update tables, etc, this request would complete before apache is shutdown completely. How reliable is this technique in ensuring tables don't lose integrity? Short of using InnoDB and transactions (which I did not do - I used MyISAM) what can I do to ensure upgrades are painless???

Cheers,
Alex

Re: Graceful upgrades?

Posted: Tue Jul 06, 2010 3:24 pm
by josh
Why would you need to shut down a server in order to upgrade it? You mean upgrade the hardware?

Re: Graceful upgrades?

Posted: Tue Jul 06, 2010 3:54 pm
by Jonah Bron
josh wrote:Why would you need to shut down a server in order to upgrade it? You mean upgrade the hardware?
Perhaps he means upgrading Apache?

Re: Graceful upgrades?

Posted: Tue Jul 06, 2010 9:34 pm
by josh
Well the answer is you don't. Either you have load balanced mirrored servers or you schedule some down time. Even if it could work with apache it won't work with other packages.

If this is an apache specific question...
The USR1 or graceful signal causes the parent process to advise the children to exit after their current request (or to exit immediately if they're not serving anything). The parent re-reads its configuration files and re-opens its log files. As each child dies off the parent replaces it with a child from the new generation of the configuration, which begins serving new requests immediately.
^ but then below that it gives a disclaimer that it may not work. http://httpd.apache.org/docs/2.0/stopping.html

But if all you're doing is upgrading your PHP scripts you shouldn't need to do that.