Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We've recently started running HAProxy load balancer in front of our Zope servers. We have 2 Zope servers with two threads each and currently have HAProxy configured as follows

server cms_instance1 app:18081 check downinter 10s maxconn 2 rise 1 slowstart 300s
server cms_instance2 app:18082 check downinter 10s maxconn 2 rise 1 slowstart 300s

As each Zope instance is running 2 threads it made sense to me to follow suggestions I've seen online and set the lb maximum connections to 2 as well. However if you also have health checks configured doesn't this mean that sometimes Haproxy will have 3 connections to a Zope instance: 2 conections it's load balancing plus a health check?

In which case would it be better to set maxconn 1?

share|improve this question

closed as not constructive by womble, growse, rnxrx, Ward, Hubert Kario Sep 10 '12 at 23:20

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

add comment

2 Answers

On the whole, you want your maxconn to match the number of threads, or perhaps even add 1 extra, depending on how often your application will be returning blob results or other iterators.

Zope only uses a thread for a request until that response either produces a full result (returns a string to turn into a response), or it returns a stream (such as a ZODB BLOB file).

The latter is handled by the underlying async library, and the thread is freed for the next request. Depending on the size of the stream being served, the haproxy connection could be open for a while.

I've never seen any problems with the healthchk parameter failing because you reached the maximum number of connections configured in haproxy; I have found no evidence for this but I presume haproxy is smart enough to factor in the maxconn parameter when checking the backend health. In any case, if your cluster is so overloaded that all your backends are constantly serving at maximum capacity you probably need to add instances anyway.

share|improve this answer
add comment

When I used to manage zope-clusters, I always set maxconn to the number of threads minus one. This was done to allow a connection for health checks.

share|improve this answer
add comment

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