tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Asankha C. Perera" <>
Subject Re: Handling requests when under load - ACCEPT and RST vs non-ACCEPT
Date Wed, 07 Nov 2012 15:18:36 GMT
Hi Mark
> maxThreads limits the number of concurrent threads available for
> processing requests. "connection" != "concurrent request", primarily
> because of HTTP keep-alive.
> maxConnections can be used to limit the number of connections.
Thanks for this insight.. I initially missed this when I went through 
the Tomcat source, but now spent some time trying to understand how it 
was expected to work
> If you set maxConnections to your desired value and repeat your tests
> you will hopefully see different results. Depending on exactly how the
> load test is designed, acceptCount may still influence the results. I
> would be worth experimenting with different values for that as well (I'd
> suggest 100, 1 and 0).
However when I tested with this, the same TCP resets were seen under 
load. After analyzing the source of the NioEndpoint closer I find that 
it only delays calling "serverSock.accept()" with Thread.sleep()'s - 
which is not going to help as shown in my first Java example.

             // Loop until we receive a shutdown command
             while (running) {

                 // Loop if endpoint is paused
                 while (paused && running) {
                     state = AcceptorState.PAUSED;
                     try {
                     } catch (InterruptedException e) {
                         // Ignore

                 if (!running) {
                 state = AcceptorState.RUNNING;

                 try {
                     //if we have reached max connections, wait

                     SocketChannel socket = null;
                     try {
                         // Accept the next incoming connection from the 
                         // socket
                         socket = serverSock.accept();
                     } catch (IOException ioe) {
                         //we didn't get a socket


Asankha C. Perera

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message