Re: at what point does haproxy begin queueing requests for a backend?

2009-10-19 Thread Willy Tarreau
On Mon, Oct 19, 2009 at 12:25:00PM -0700, Hank A. Paulson wrote:
 at what point does haproxy begin queuing requests for a backend?
 
 Is it at sum(maxconn * wght)
 or sum(maxconn) ignoring wght

^^^ This one precisely

 or is it at fullconn even if fullconn is less than the above 2 values
 or some other point?

No, fullconn determines when maxconn is applied in case of dynamic
limitation (when using minconn too), don't use this unless you know
you want it. It's too hard to explain how it works, and it seems even
harder to understand :-)

 Under what circumstances does haproxy queue directly to a certain server 
 for a given backend vs a global queue for that whole backend, if ever?

It does so when the request contains a cookie indicating it must be
processed by that server and not by any other one. The backend's queue
is dequeued when a server releases a connection and finds a connection
in the backend queue that has been here for more time than the next
connection in its own queue. This ensures a very fair queuing.

You can take a look at that diagram for more information :

   http://haproxy.1wt.eu/download/1.3/doc/queuing.pdf


Regards,
Willy




Re: at what point does haproxy begin queueing requests for a backend?

2009-10-19 Thread Hank A. Paulson

On 10/19/09 12:46 PM, Willy Tarreau wrote:

On Mon, Oct 19, 2009 at 12:25:00PM -0700, Hank A. Paulson wrote:

at what point does haproxy begin queuing requests for a backend?

Is it at sum(maxconn * wght)
or sum(maxconn) ignoring wght


^^^ This one precisely


or is it at fullconn even if fullconn is less than the above 2 values
or some other point?


No, fullconn determines when maxconn is applied in case of dynamic
limitation (when using minconn too), don't use this unless you know
you want it. It's too hard to explain how it works, and it seems even
harder to understand :-)


Under what circumstances does haproxy queue directly to a certain server
for a given backend vs a global queue for that whole backend, if ever?


It does so when the request contains a cookie indicating it must be
processed by that server and not by any other one. The backend's queue
is dequeued when a server releases a connection and finds a connection
in the backend queue that has been here for more time than the next
connection in its own queue. This ensures a very fair queuing.


So then in the case of a system with cookies you could have a request with an 
existing cookie wait for longer than a request that is new?
a connection in the backend queue that has been here for more time than the 
next connection in its own [a given server for that backend] queue.




You can take a look at that diagram for more information :

http://haproxy.1wt.eu/download/1.3/doc/queuing.pdf


Thanks, I had seen that before but wasn't sure exactly what calculated value 
point triggered the queuing. But that diagram brings up another question:
If your maxqueue is 8192, then the queue for a backend and the individual 
server queues can all be 8192 each? And at what level is the global queue at 
global global or is it at each backend?





Regards,
Willy