Apache · Configuration and operations
What is a graceful restart and when should you use it?
Short answer
A graceful restart reloads configuration and replaces workers while letting in-flight requests finish. Use it for configuration and certificate changes; use a full restart only when the process or its environment must change.
Apache's graceful restart signals the parent to start new children with the new configuration. Old children stop accepting new connections and exit after their current requests complete. Clients should not see dropped connections, although long-lived connections may keep old workers alive for a while.
apachectl configtest
apachectl graceful
systemctl reload apache2
systemctl status apache2
apachectl graceful-stop
apachectl -k restartWhat it does and does not do
- Applies new configuration and reloads certificates
- Keeps the parent process and listening sockets
- Lets old workers finish active requests before exiting
- Does not change environment variables or the binary
- Does not fix a corrupted module or a leaked file descriptor in the parent
- May leave old workers around if a request hangs, so monitor process age
Always run configtest first. A graceful restart with an invalid configuration may fail to spawn new workers while old ones continue, leaving you in a confusing partial state. For a new Apache binary or a changed systemd unit, use a full restart with a drain window.
Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1What signal does a graceful restart send?
- 2How does graceful differ from graceful-stop?
- 3When must you use a full restart instead?
- 4How do you verify that reloads are not leaking workers?
Say it in the interview
A graceful restart tells the parent to load new configuration and start new children while old ones drain. Existing requests finish, and the listening sockets stay open. I always run configtest first, then reload through systemd or apachectl. For a new binary or environment change I plan a full restart with a drain window.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live Apache mock interview and get scored feedback on depth, clarity and confidence.