------------------------------------------------------------------------
*From:* Patrick Hemmer [mailto:hapr...@stormcloud9.net]
*Sent:* Friday, June 28, 2019, 11:50 EDT
*To:* HAProxy <haproxy@formilux.org>
*Subject:* fullconn not working
I'm trying to get fullconn working, and can't seem to do so. I dunno
if it's a bug, or if it's my understanding that's wrong.
Basically my goal is to prevent the cumulative total of all
connections to all servers in a pool from exceeding a certain value.
For example I might have 10 servers, each with a maxconn of 10. But I
want to configure haproxy with a pool-wide limit of 50, so that even
if the connections are well distributed and no one server is maxed
out, after 50 connections to all servers, haproxy will still start to
queue instead.
fullconn seems like the right way to accomplish this, however I cannot
get it to work. I've tried a simple setup of 2 servers, each with
`maxconn 3`, and then a backend `fullconn 2`, which should result in
queuing after 2 simultaneous connections, however it doesn't. If I
send 4 connections, all 4 are simultaneously sent to the backend servers.
Here's my test config:
defaults
log 127.0.0.1:1234 daemon
mode http
option httplog
timeout queue 5s
frontend f1
bind :8001
default_backend b1
backend b1
fullconn 2
server s1 127.0.0.1:8081 minconn 1 maxconn 3
server s2 127.0.0.1:8081 minconn 1 maxconn 3
Here's how I test:
for i in {1..4}; do curl "http://localhost:8001/?sleep=2&num=$i" & done
And here's the logs:
<30>Jun 28 11:37:47 haproxy[75322]: 127.0.0.1:55119
[28/Jun/2019:11:37:45.658] f1 b1/s2 0/0/0/2003/2003 200 75 - - ----
4/4/3/2/0 0/0 "GET /?sleep=2&num=3 HTTP/1.1"
<30>Jun 28 11:37:47 haproxy[75322]: 127.0.0.1:55117
[28/Jun/2019:11:37:45.658] f1 b1/s2 0/0/0/2003/2003 200 75 - - ----
4/4/2/1/0 0/0 "GET /?sleep=2&num=4 HTTP/1.1"
<30>Jun 28 11:37:47 haproxy[75322]: 127.0.0.1:55118
[28/Jun/2019:11:37:45.658] f1 b1/s1 0/0/0/2003/2003 200 75 - - ----
4/4/1/2/0 0/0 "GET /?sleep=2&num=1 HTTP/1.1"
<30>Jun 28 11:37:47 haproxy[75322]: 127.0.0.1:55120
[28/Jun/2019:11:37:45.658] f1 b1/s1 0/0/0/2003/2003 200 75 - - ----
4/4/0/1/0 0/0 "GET /?sleep=2&num=2 HTTP/1.1"
So am I misunderstanding how fullconn works? Or is there a bug?
I've tested with 2.0.1, 1.9.8, and 1.8.13.
-Patrick
Anyone with any thoughts on this? Anyone using fullconn successfully?
As an additional item of note that makes me suspect this is a bug even
more is that when viewing the stats page, it shows the number of
sessions is greater than the limit.
-Patrick