Restarting Apache? Use graceful instead of restart.

Posted by Sheldon Finlay on July 09, 2009

If you need to restart Apache on a live server, you have a few options. The common method which I often see discussed is

apachectl restart

This immediately tells the parent server to kill of its children (quite violent, no?) and then reload. The problem with doing this is it will end any active connections. So if you have visitors reading or writing to the server it will stop them dead in their tracks. They might even receive a connection error page in their browsers.

A better way to restart Apache using the graceful command:

apachectl graceful

This tells the parent to signal to its children to finish whatever they are doing and die (more compassionate). So if you have a visitor uploading a file or in a mid-stream connection, they should not receive an error. They may receive a small delay while things start up again, but overall, the restart should be barely noticable. Read more about the specifics of Apache restarting and stopping.

Trackbacks

Use this link to trackback from your own site.

Comments

Leave a response

Comments