I'm just trying to wrap my head around queueing/timeouts in HaProxy between a frontend, backend and a server. I'm still learning about TCP, sockets, connections etc so forgive me if any of these questions don't make sense. I'm just looking for confirmation/clarification on a few of these items:
Client connections and frontend load balancing
Haproxy itself has a global maxconn
limit (I'll call this gmc
). From what I understand, this gmc
is on incoming connections from clients (routed to front-ends).
Each frontend then has its own maxconn
setting (I'll call it femc
).
If my gmc
is 40, and I have two frontends each with femc
of 10 and I get 50 requests in at once.
Questions:
- Is it true that 20 will be accepted (10 by each frontend), 20 will be backlogged (10 on each frontend), and the leftover 10 will be backlogged globally at the proxy level?
- Is there a global backlog AND a frontend backlog? Or is the
backlog
parameter only relevant at the frontend. - If there is a global backlog, is this just OS specific based on # of file descriptors available?
- If we set our max backlog to be 1, what would happen to the leftover requests coming in? Would they be denied right away? (this depends I guess on previous answer)
- does the global maxconn also apply to backend connections? Is it the upper bound on ALL connections across the whole system?
Server connections and request queueing
Continuing with the example above, we'll add one backend for each frontend, both with two servers with a maxconn
of 2 each (smc
) and a maxqueue of 1 (smq
).
So each backend can handle 4 simultaneous requests (2 per server) and will queue 2 requests (1 per server) 6 requests total per backend
Questions:
- What happens with the extra 4 requests that the frontend has received? Are they "queued" there? Is there a parameter on the frontend that controls this queueing?
- Does a backend have its own queue that isn't configurable? (maxqueue only seems to be at a server level)
I'm asking all of this because we have a legacy server with VERY heterogeneous request properties. Some can happen in 10ms
, some 10s
. We currently don't have any limits at all on server connections, and we're seeing some of our web server's backlogs filling up behind really slow requests while others are almost idle. Ultimately I'm trying to smooth this out a bit.
Any answers to the above questions would be SUPER helpful!
0 Answers