Hi,



> I add an option maxconn after keyword server. When haproxy face 
> high volume of requests (about 20000 concurrent requests), it return 
> many 503 page

Of course it will.

You would like to serve 20000 concurrent requests, but your 6 servers
only support 180 concurrent connections each. Do the math:

6 x 180 = 1080 concurrent request can be served in your configuration,
of course you will see a lot of 503 errors.



> why did haproxy send 503 page?

Because all backend servers are busy serving 180 concurrent requests,
as per your configuration. You have instructed HAProxy not the send
more than 180 request per server, and that is exactly what HAProxy
is doing (queueing the request until timeout queue [2] expires and
then sending 503 errors).



> I also did not understand the meaning of optioin maxconn. If I remove 
> this option, haproxy will return only very few 503 page.

Please read the documentation about maxconn fully [1] then.



> Do option maxconn in above configration mean: if concurrent requests 
> come from frontend is bigger than 180, haproxy will reject these 
> requests and return 503?

It means: each server can handle up to 180 concurrent requests and HAproxy
will not send more request to the server, but either use a different server
(if there are), or queue it until "timeout queue" [2] expires, or
"contimeout" as it is in your case (3 seconds).



> If yes, can I configure the size of the queue?

180 *is* your per server queue size, and its exactly the limitation
you are hitting.



> Additional info 
> [jj@p2p3 tmp]$ echo "show errors" | sudo socat stdio /tmp/haproxysock 
> Total events captured on [01/Jul/2014:18:49:29.713] : 0 

You gonna need to configure the stats socket properly, "show errors"
requires operator or admin privileges on the socket [2] ("level admin").





Regards,

Lukas



[1] 
http://cbonte.github.io/haproxy-dconv/configuration-1.5.html#maxconn%20%28Server%20and%20default-server%20options%29
[2] http://cbonte.github.io/haproxy-dconv/configuration-1.5.html#timeout%20queue
[3] 
http://cbonte.github.io/haproxy-dconv/configuration-1.5.html#9.2-show%20errors  
                                      

Reply via email to