HAProxy supports a graceful and a hard stop.
The hard stop occurs when the SIGTERM signal is sent to the
haproxy process, which immediately quits and closes all established connections. The hard stop method is used for the "stop" or "restart" actions of the service management script.
The graceful stop is triggered when the SIGUSR1 signal is sent to the
haproxy process. It only consists in unbinding from listening ports, but continues to process existing connections until they close. Once the last connection is closed, the process leaves. The graceful stop is used for the "reload" action, which tries to reload seamlessly a new configuration in a new process.
Both of these signals may be sent by the new
haproxy process itself during a reload or restart, so that they are sent at the latest possible moment and only if absolutely required.
You do this with the
-st (hard) and
-sf (graceful) options respectively.
Restart in master-worker model
In master-worker mode, it is not necessary to start a new HAProxy process in order to reload the configuration. The master process reacts to the SIGUSR2 signal by re-executing itself with the
-sf parameter followed by the PIDs of the workers. The master will then parse the configuration file and reload new workers automatically.