Setting maxconns in HAProxy 1.8

It seems that haproxy has a maxconns of 2000. This is what my stats show:

pid = 1719 (process #1, nbproc = 1, nbthread = 1)
uptime = 0d 1h11m42s
system limits: memmax = unlimited; ulimit-n = 4036
maxsock = 4036; maxconn = 2000; maxpipes = 0
current conns = 1; current pipes = 0/0; conn rate = 3/sec
Running tasks: 1/19; idle = 100 %

I’m trying to figure out how to raise that.

Global/Default Config:

global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats timeout 30s
user haproxy
group haproxy
daemon

defaults
log global
mode tcp
option tcplog
option dontlognull
timeout connect 300
timeout client 300
timeout server 300
maxconn 5000

Regardless of setting 5000 as maxconns, it stays at 2000. I’ve also tried to change the max open files to 50k but it still stays at 4036.

[haproxy@haproxy:root]$ ulimit -n
50000

I have LimitNOFILE set to 50k in the systemd configuration:

[root@haproxy:/root]$ grep LimitNoFile -i /etc/systemd/system/haproxy.service
LimitNOFILE=50000
[root@haproxy:/root]$

Nothing seems to work - am I missing something really simple here?

$ haproxy -vv
HA-Proxy version 1.8.27-493ce0b 2020/11/06
Copyright 2000-2020 Willy Tarreau willy@haproxy.org

Build options :
TARGET = linux2628
CPU = generic
CC = gcc
CFLAGS = -O2 -g -fno-strict-aliasing -Wdeclaration-after-statement -fwrapv -Wno-null-dereference -Wno-unused-label -Wno-stringop-overflow
OPTIONS = USE_LINUX_TPROXY=1 USE_CRYPT_H=1 USE_GETADDRINFO=1 USE_ZLIB=1 USE_REGPARM=1 USE_OPENSSL=1 USE_LUA=1 USE_SYSTEMD=1 USE_PCRE=1

Default settings :
maxconn = 2000, bufsize = 16384, maxrewrite = 1024, maxpollevents = 200

Hi,

You need to add a “maxconn 5000” in the global section too.
The global section maxconn value sets the number of connections “process wide”.

Baptiste

1 Like

Ahh, thank you very much!