Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i have any instances under an haproxy loadbalancer. i am using the haproxy cookies to make each client connect to the same server troughout his whole session.

now the thing is, I would like to setup the maxconn variable in haproxy to the limit that my servers can handle, which is, say, 1000.

I would like to make sure, although, that in case this limit is reached, it only applies to new connections, and not to the people who are already logged into the system. Is this the way it works? If not, how can I achieve this?

share|improve this question

The server maxconn applies to concurrent TCP connections to the server in order not to overload the server. However, excess connections are not rejected, they're queued and forwarded to the server as soon as it releases another connection. There are two queues, one in the backend for any incoming connection, and another one at the server dedicated to connections explicitly aimed at this server (requests with cookies). So what happens is that connections from new visitors are queued at the backend and picked by any server, while connections from already seen visitors are queued at the server and picked by this one only.

You seem to believe that maxconn counts concurrent visitors, while it really is concurrent connections. You can easily have 10000 concurrent visitors with only 100 concurrent TCP connections. The maxconn is analog to Apache's MaxClients setting and should be set slightly lower than the server's limit.

You'll also observe that many servers perform better with lower maxconn values, and you might be tempted by lowering the value to improve performance. Don't lower it too much though, as you want to be able to cover the situations where your server serves slow responses (eg: waits for a database server).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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