On Παρασκευή, 28 Ιουνίου 2019 5:50:48 Μ.Μ. CEST Patrick Hemmer wrote:
> 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"
> 
> 

Your e-mail client mangled above log lines and as a result they are bit 
unreadable.
The 4th field from `4/4/3/2/0`  is srv_conn  *2* which is below the maxconn of 
*3*, so haproxy did
the right thing as it didn't allow more than *full_conn* connections to be 
concurrently opened
against the server.

Cheers,
Pavlos



Reply via email to