Skip to content

[4.0] Rework haproxy config for stickiness and balance strategy#209

Merged
matelakat merged 7 commits intocrowbar:stable/4.0from
matelakat:backport-haproxy-stickiness
Jul 16, 2017
Merged

[4.0] Rework haproxy config for stickiness and balance strategy#209
matelakat merged 7 commits intocrowbar:stable/4.0from
matelakat:backport-haproxy-stickiness

Conversation

@matelakat
Copy link
Contributor

@matelakat matelakat commented Jul 14, 2017

This is the backport of #208

We enable stickiness based on SSL sessions
We add the ability to do stickiness based on cookies
We allow to define the balance strategy on a per-resource basis
We stop overriding the default balance strategy (and therefore use roundrobin by default)

vuntz and others added 7 commits July 14, 2017 15:50
We have haproxy 1.5.x now, so we can use persistence for SSL sessions.
This matters as if we want to allow people to not use "source" as
balance algorithm, then we need to make sure that sessions keep going to
the same backend to avoid breakages.

This reverts commit 32323b0.

(cherry picked from commit ba2fd30)
This is done in the LWRP and in the template; let's just do it in the
LWRP to simplify the template.

(cherry picked from commit ba3d9fd)
This is useful to achieve persistence for web apps which have a session,
which is important in order to allow using a different algorithm than
"source" for balancing without breaking sessions.

(cherry picked from commit 7411535)
This allows achieving persistence for a normal session, but also for the
login form where there's usually a CSRF token (and which is not
associated to a real session in the web app).

(cherry picked from commit 8c3fdbf)
This enables customization of the balance strategy for each service.

(cherry picked from commit 1c6dbf8)
The default in the haproxy cookbook is roundrobin, and this should
actually work fine. In cases where this may be troublesome (like web
apps), we can now configure stickiness to avoid issues.

With roundrobin, we spread the load accross the various backends, which
results in much improved performance.

(cherry picked from commit 592b5d9)
(cherry picked from commit c07c255)
attribute :port, kind_of: Integer, default: 0
attribute :mode, kind_of: String, default: "http", equal_to: ["http", "tcp", "health"]
attribute :balance, kind_of: String, default: "",
equal_to: ["", "roundrobin", "static-rr", "leastconn", "first", "source"]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/AlignHash: Align the elements of a hash literal if they span more than one line. (https://github.com/SUSE/style-guides/blob/master/Ruby.md#stylealignhash)

@matelakat matelakat merged commit a38e2a0 into crowbar:stable/4.0 Jul 16, 2017
@matelakat matelakat deleted the backport-haproxy-stickiness branch July 16, 2017 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants