As shown in the image below, I have a HAProxy backend with 2 servers which have the following settings:

maxconn 64 check inter 5s fastinter 2s downinter 2s

enter image description here

My question regards the Queue column. How can I specify the limit of the backend queue? And why does the Backend at the bottom, show the value of 11 when api-1 and api-2 show 22 and 18 respectively? What does the number 11 represent in my case?


Question 1/
As mentioned by Willy in this thread: https://www.mail-archive.com/haproxy@formilux.org/msg21521.html , you can't specify maxqueue for a backend but you can do it for backend's servers.

First let's make it clear about queues: There is a per-backend queue and a per-server queue. Connections with a server persistence go to the server (in question) queue and other connections go to the backend queue.

When a server maxqueue is reached, the HAProxy doc http://cbonte.github.io/haproxy-dconv/1.7/configuration.html#5.2-maxqueue says that

If this limit is reached, next requests will be redispatched to other servers instead of indefinitely waiting to be served. This will break persistence but may allow people to quickly re-log in when the server they try to connect to is dying.

So next requests won't be lost in this case.

It would be different if a supposed backend maxqueue is reached and clients may get errors in return. Thus, To avoid this, there is no backend maxqueue implementation but you still can achieve the same behavior using a rule in the backend like this:

backend foo
      tcp-request content reject if { queue ge 100 }

Question 2/
The column Max Queue tells the Maximum Queue size reached since the last HAProxy reload.
So 11 is the Maximum Queue size reached by your backend. This is different from the Max Queue size of your servers because, as said earlier, backend queue and servers queues are separated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.