Yes, this must use BIO mode, because the NIO maxConnections=10000 in default, it won't block the LimitLatch. In my test case,(use JMeter, thread number is 5), 2 requests will refused soon(just 1s-2s later), then another 3 requests will served correctly.In source code, I find the backlog attribute will send to ServerSocket constructor, So, the backlog attribute is worked inside of JDK, not in Tomcat? Thank you all for reply.
2013/12/27 Mark Thomas <ma...@apache.org> > On 27/12/2013 08:53, Mark Eggers wrote: > > On 12/27/2013 12:37 AM, Mark Thomas wrote: > >> On 27/12/2013 07:27, Mark Eggers wrote: > >>> On 12/26/2013 11:09 PM, 侯树成 wrote: > >> > >>>> 1.set tomcat connector like this: > >>>> <Connector port="8080" protocol="HTTP/1.1" > >>>> connectionTimeout="20000" > >>>> redirectPort="8443" acceptCount="1" maxThreads="1" > >>>> minSpareThreads="1"/> > >>>> > >>>> 2. deploy a war file, which contains a servlet that will sleep 60s in > >>>> it's > >>>> doPost method > >>>> > >>>> 3. use LR or JMeter send 5 requests to the serlvet above > >>>> > >> > >>> I'm going to guess based on the Tomcat 7 documentation: > >>> > >>> request 1 gets executed and sits in your doPost for 60 seconds > >>> request 2 consumes the minSpareThread > >>> request 3 consumes the acceptCount > >>> > >>> Per documentation, connections 4 and 5 are dropped immediately. > >> > >> That is almost right except that there should not be a spare thread at > >> step 2 since maxThreads includes any spare threads. > >> > > > > Yep, that's what I would expect as well. I was just trying to > > rationalize the third accept. > > > > I agree, I would think that 1 would be served, 2 would wait, and 3-5 > > would be dropped. > > Figured it out. The OP is using BIO where maxConnections == maxThreads > by default. > > Request 1 uses the one available request processing thread. > > Request 2 is accepted but is blocked since the maximum number of > connections has been reached. > > Request 3 uses the accept count. > > Requests 4 & 5 are blocked. > > It might be worth a note in the docs that the number of connections > accepted will always be maxConnections + 1 with the "+ 1" being blocked > in the acceptor thread until the number of connections drops below > maxConnections again. I'll try and add something later today. > > Mark > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > >