Restarting HAProxy using the default init scripts will kill any existing connections, and prevent any new connections while it restarts. With the init script restart method (eg ‘/etc/init.d/haproxy restart’), if there are any configuration errors, the service wont start up again. This might be fine for low volume sites, but if you are dealing with heavy traffic, you would want to reload the configuration with the smallest amount of downtime possible.
Thankfully HAProxy provides the ability to do this. The ‘-st’ and ‘-sf’ parameter options are used for hot configuration changes.
Both parameter options allow for hot configuration changes, with the difference being that the ‘-st’ option forces the existing HAProxy instance to kill all existing connections, where as the ‘-sf’ option tells the existing HAProxy instance to finish doing any work, and then softly close.
If there are any configuration errors in the config file, HAProxy will not complete the configuration reload, and will remain running with the existing config.
Example of a configuration reload using -sf (wait for HAProxy to finish any ‘work’):
$ sudo haproxy -p /var/run/haproxy.pid -sf $(cat /var/run/haproxy.pid)
For RHEL/CentOS/Fedora, the packaged init scripts provide a reload method that implements what you mentioned in this article.