1

In our test environment we've identified a strange HAProxy behavior. We're using the standard RHEL 7 provided haproxy-1.5.18-8.el7.x86_64 RPM.

According to our understanding, the total number of accepted parallel connections is defined as maxconn*nbproc from global section of the haproxy.cfg.

However if we define:

maxconn   5
nbproc    2

we'd expect total number of parallel connections to be 10. But we can't get over maxconn defined 5.

Why is the nbproc being ignored?

Here is the complete haproxy.cfg:

# Global settings
global
    log         127.0.0.1 local2 warning
    log         10.229.253.86 local2 warning

    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     5
    user        haproxy
    group       haproxy
    daemon
    nbproc      2

# turn on stats unix socket
    stats socket /var/lib/haproxy/stats
    stats socket /var/run/haproxy.sock mode 600 level admin
    stats socket /var/run/haproxy_hamonit.sock uid 2033 gid 2033 mode 600 level admin
    stats timeout 2m

defaults
    mode                    tcp
    log                     global
    option                  tcplog
    option                  dontlognull
    option                  redispatch

    retries                 3
    timeout http-request    10s
    timeout queue           1m
    timeout connect         10s
    timeout client          30s
    timeout server          30s
    timeout http-keep-alive 10s
    timeout check           10s

    bind-process            all

frontend ha01
    bind 10.229.253.89:80
    mode                        http
    option                      httplog
    option                      http-server-close
    option forwardfor           except 127.0.0.0/8

    default_backend             ha01

backend ha01
    balance roundrobin
    mode                        http
    option                      httplog
    option                      http-server-close
    option forwardfor           except 127.0.0.0/8
    server  server1 10.230.11.252:4240 check
    server  server2 10.230.11.252:4242 check

listen stats 10.229.253.89:1936
    mode http
    stats enable
    stats hide-version
    stats realm Haproxy\ Statistics
    stats uri /
    stats auth admin:foo

1 Answer 1

0

I've found the culprit. We were reading statistics from socket interface. However in our config, there is just 1 socket interface which binds to only one process. And therefore we can't get statistics from other processes. HAProxy unfortunately doesn't support aggregated statistics via socket interface (if it does, please share how).

So when I changed to exact binding:

stats socket /var/run/haproxy.sock mode 600 level admin process 1
stats socket /var/run/haproxy2.sock mode 600 level admin process 2

I can get statistics from both sockets when nbproc=2:

echo "show sess" | socat /var/run/haproxy.sock stdio
echo "show sess" | socat /var/run/haproxy2.sock stdio

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.