On Wed, Oct 10, 2012 at 9:44 PM, Jeff Rogers <dv...@diphi.com> wrote: > > It is possible to get into a situation where there are connections > queued but no conn threads running to handle them, meaning nothing > happens until a new connection comes in. When this happens the server > will also not shut down cleanly. As far as I can figure, this can only > happen if the connection queue is larger than connsperthread and the > load is very bursty (i.e., a load test); all the existing conn threads > can hit their cpt and exit, but a new conn thread only starts when a new > connection is queued. I think the solution here is to limit > maxconnections to no more than connsperthread. Doing so exposes a less > severe problem where connections waiting in the driver thread don't get > queued for some time; it's less of a problem because there is a timeout > and the dirver thread will typically wake up on a closing socket fairly > soon, but it can still result in a simple request taking ~3s to > complete. I don't know how to fix this latter problem.
I think this is racy because all conn threads block on a single condition variable. The driver thread and conn threads must cooperate to manage the whole life cycle and the code to manage the state is spread around. If instead all conn thread were in a queue, each with it's own condition variable, the driver thread could have sole responsibility for choosing which conn thread to run by signalling it directly, probably in LIFO order rather than the current semi-round-robin order which tends to cause all conn threads to expire at once. Conn threads would return to the front of the queue, unless wishing to expire in which case they'd go on the back of the queue, and the driver would signal when it was convenient to do so. Something like that... ------------------------------------------------------------------------------ Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev _______________________________________________ naviserver-devel mailing list naviserver-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/naviserver-devel