Bug 230305 - [PATCH] net/haproxy-devel: add support for seamless reloads
Summary: [PATCH] net/haproxy-devel: add support for seamless reloads
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Dmitry Sivachenko
Depends on:
Reported: 2018-08-02 20:22 UTC by Frank Wall
Modified: 2018-08-24 19:24 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (demon)

patch for net/haproxy-devel (1022 bytes, text/plain)
2018-08-02 20:22 UTC, Frank Wall
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Wall 2018-08-02 20:22:53 UTC
Created attachment 195774 [details]
patch for net/haproxy-devel

Starting with 1.8 HAProxy supports truly seamless reloads. This patch adds support for this new mode through the "softreload" command, which is a nice addition to the previously added "hardreload" command (#221402).

To be able to use the seamless reloads feature, a user needs to add the following configuration to haproxy.conf:
stats  socket /var/run/haproxy/socket level admin expose-fd listeners
The path is configurable through the new $haproxy_socket variable.

If HAProxy is not configured for seamless reloads, HAProxy will issue a clear error message:
[ALERT] 213/214703 (18320) : Failed to get the sockets from the old process!
Comment 1 Dmitry Sivachenko freebsd_committer 2018-08-03 14:23:31 UTC

I always used "/usr/local/etc/rc.d/haproxy reload" to reload haproxy config and keep all currently serving requests.

Can you please explain a bit why this one is better?

Comment 2 Frank Wall 2018-08-03 17:32:46 UTC
Seamless reloads basically means that you will not loose a single request, it allows for zero downtime restarts.

The developer shares some more insights:
Comment 3 Dmitry Sivachenko freebsd_committer 2018-08-03 20:35:31 UTC
Well, after reading this article I got an impression that only Linux is affected, and
BSD had no problems with loosing connections on reload.

Anyway I have nothing against your patch (provided it does not change current behaviour), but I think we do not need it thought.

I'll commit it soon.
Comment 4 Frank Wall 2018-08-05 09:16:29 UTC
> I'll commit it soon.

Thanks, Dmitry!

To be clear with this, seamless reloads is a completely new feature. It greatly improves HAProxy's restart behaviour (on BSD and on Linux):

1. When triggering a restart, HAProxy first starts a new process
2. Next it will transfer all sockets from the old to the new process
3. Finally the old process is terminated

This way frequent configuration changes (restarts) become invisible to the users.
Comment 5 Frank Wall 2018-08-23 13:30:30 UTC
@Dmitry: Do you plan to commit the patch unmodified? Or do you want me to change anything?
Comment 6 commit-hook freebsd_committer 2018-08-24 19:19:32 UTC
A commit references this bug:

Author: demon
Date: Fri Aug 24 19:19:27 UTC 2018
New revision: 477980
URL: https://svnweb.freebsd.org/changeset/ports/477980

  Add 'softreload' command for seamless haproxy reload (-x option).

  PR:		230305
  Submitted by:	Frank Wall <fw@moov.de>

Comment 7 Dmitry Sivachenko freebsd_committer 2018-08-24 19:20:20 UTC
Patch committed, thanks!

(sorry for the delay, I am on vacation).
Comment 8 Frank Wall 2018-08-24 19:24:10 UTC
A HUGE thank you, Dmitry! Enjoy your vacation!