You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jo...@wellsfargo.com.INVALID on 2019/08/01 20:10:22 UTC

failing fast when the server is overloaded

Folks,

I've been using Tomcat for a long time but am new-ish to NIO (Tomcat 8.5.)  It seems that one of the big benefits of NIO is decoupling the worker threads from the client connections.  I can now have a large number of open connections without a corresponding large number of threads.

I know the acceptCount parameter will stop incoming connection requests if the server is overloaded.  However, suppose I have 1000 open connections and 100 of those connections have a request in flight, using all 100 of the threads I've allocated.  Now what happens if the other 900 connections suddenly send me requests?  Does acceptCount play any role?  Is there some other mechanism that I can use to fail fast (by sending back a 503, for example?)

Thanks

John

Re: failing fast when the server is overloaded

Posted by Mark Thomas <ma...@apache.org>.
On 01/08/2019 21:10, John.E.Gregg@wellsfargo.com.INVALID wrote:
> Folks,
> 
> I've been using Tomcat for a long time but am new-ish to NIO (Tomcat 8.5.)  It seems that one of the big benefits of NIO is decoupling the worker threads from the client connections.  I can now have a large number of open connections without a corresponding large number of threads.
> 
> I know the acceptCount parameter will stop incoming connection requests if the server is overloaded.  However, suppose I have 1000 open connections and 100 of those connections have a request in flight, using all 100 of the threads I've allocated.  Now what happens if the other 900 connections suddenly send me requests?

They wait until either the client times out waiting to read the response
or one of the 100 allocated threads completes the request/response it
was working and takes the next of the 900 waiting requests off the queue.

> Does acceptCount play any role?

No, no with those numbers. If you increase that 900 then acceptCount
will - eventually - play a role.

>  Is there some other mechanism that I can use to fail fast (by sending back a 503, for example?)

Short of decreasing maxConnections, no.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org