On 12.10.12 21:07, Jeff Rogers wrote:

>> less than the number of queued requests, there will be threads
>> left in the queue when the last connection thread exits.
>>
>> I have done some refactoring and added a liveliness test to
>> the driver.
>> it is set up currently with a timeout of 1 second.
> I have a different solution which seems simpler, but I'm not sure if it
> has non-obvious implications.  What I did is to check when the conn
> thread exits if it exited because it hit maxconns and there are still
> conections queued, and if so spawn a replacement thread before exiting.
i had this before, but dropped this path. With the 
re-factored code,
it is just one line to call  
NsEnsureRunningConnectionThreads() at
connection thread exit. If one simply does this, then there 
is a
problem with thread joining/reaping, threads won't 
disappear, etc.
This is at least what i experienced under Mac OS X.

The bad part about the timeout-based approach is that this
leads to worse than necessary results on "benchmarks",
since the final drainage of the queue depends on a timeout.

Actually, i think it is better and simpler to handle this 
pathological
cases by extending the "overtime" working in such cases.
When the server is running out of threads, and there are
still queued requests, they could be allowed to be handled
by the existing connection threads. The number of requests
handled by a connection threads is already stochastically
determined per default. Under normal work conditions, the
queue backlog is handled as usual via the incoming traffic,
only the final drainage happens this way.
I have just added a minimal invasive change to the repository.
When other agree this to be a good solution for such cases,
i think, it can be simplified  further...

all the best
-gustaf neumann

------------------------------------------------------------------------------
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

Reply via email to