On Thu, Apr 14, 2016 at 11:49:47AM +0200, Christian Ruppert wrote:
> Yep, that did it. With this setting there is no more performance decrease on
> the http bind. Thanks!
> I'm just not sure if that will (negatively) affect anything else.

It may, depending on your setup (eg: if some frontends can drain many
connections at once it can increase latency).

Better apply the attached patch instead which divides by the number of
processes the listener is bound to :-)

Willy

>From 7c0ffd23d2d13e464a401292dcf55f658f2d3e24 Mon Sep 17 00:00:00 2001
From: Willy Tarreau <w...@1wt.eu>
Date: Thu, 14 Apr 2016 11:47:38 +0200
Subject: BUG/MEDIUM: fix maxaccept computation on per-process listeners

Christian Ruppert reported a performance degradation when binding a
single frontend to many processes while only one bind line was being
used, bound to a single process.

The reason comes from the fact that whenever a listener is bound to
multiple processes, the it is assigned a maxaccept value which equals
half the global maxaccept value divided by the number of processes the
frontend is bound to. The purpose is to ensure that no single process
will drain all the incoming requests at once and ensure a fair share
between all listeners. Usually this works pretty well, when a listener
is bound to all the processes of its frontend. But here we're in a
situation where the maxaccept of a listener which is bound to a single
process is still divided by a large value.

The fix consists in taking into account the number of processes the
listener is bound do and not only those of the frontend. This way it
is perfectly possible to benefit from nbproc and SO_REUSEPORT without
performance degradation.

1.6 and 1.5 normally suffer from the same issue.
---
 src/cfgparse.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/cfgparse.c b/src/cfgparse.c
index 2d0a020..c3b29d4 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -8694,9 +8694,6 @@ out_uri_auth_compat:
        for (curproxy = proxy; curproxy; curproxy = curproxy->next) {
                struct listener *listener;
                unsigned int next_id;
-               int nbproc;
-
-               nbproc = my_popcountl(curproxy->bind_proc & 
nbits(global.nbproc));
 
 #ifdef USE_OPENSSL
                /* Configure SSL for each bind line.
@@ -8741,6 +8738,15 @@ out_uri_auth_compat:
                /* adjust this proxy's listeners */
                next_id = 1;
                list_for_each_entry(listener, &curproxy->conf.listeners, by_fe) 
{
+                       int nbproc;
+
+                       nbproc = my_popcountl(curproxy->bind_proc &
+                                             listener->bind_conf->bind_proc &
+                                             nbits(global.nbproc));
+
+                       if (!nbproc) /* no intersection between listener and 
frontend */
+                               nbproc = 1;
+
                        if (!listener->luid) {
                                /* listener ID not set, use automatic numbering 
with first
                                 * spare entry starting with next_luid.
@@ -8819,7 +8825,7 @@ out_uri_auth_compat:
 #endif /* USE_OPENSSL */
                }
 
-               if (nbproc > 1) {
+               if (my_popcountl(curproxy->bind_proc & nbits(global.nbproc)) > 
1) {
                        if (curproxy->uri_auth) {
                                int count, maxproc = 0;
 
-- 
1.7.12.1

Reply via email to