Hi Chris, thanks for the reply. Concerning your questions: I believe acceptCount can not work with value 0 because if I am not wrong, the acceptCount is the value passed as backlog in the ServerSocket constructor. According to javadoc if the backlog value is less than or equal to 0, then a default value is used instead which is 50. So acceptCount=0 does not mean that backlog queue does not queue anything. That is why I used the value 1 instead. Also when I say I was expecting a network failure (bad terminology) I meant that the client would get a failure in the TCP attempt to connect. Also I used maxThreads=0 and the server worked fine. Did not see any problem in my applications. Did not check the logs though. I assumed that perhaps 0 would be set to some default value. Can not answer about your observation.It also makes me wonder. Finally concerning my test setup, I need to configure Tomcat to limit the amount of concurrent client requests accepted. I need to configure it so that e.g. 300 concurrent clients can connect but the 301 will not be able to connect (not queued by OS either). That client will see a failure to connect to server in TCP level. Do you need more info on this?
Best Regards ________________________________ From: Christopher Schultz <ch...@christopherschultz.net> To: Tomcat Users List <users@tomcat.apache.org> Sent: Wednesday, January 16, 2013 7:52 PM Subject: Re: Can not understand how maxThreads of Connectors works -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Hermes, On 1/16/13 11:01 AM, Hermes Flying wrote: > I am trying to understand how the maxThreads attribute of > Connectors works. I did some tests in order to configure Tomcat to > limit the number of concurrent client requests (as asked in my > previous mail). Please copy anything relevant into this thread. Otherwise the archives don't work very well. > Did the following trivial configuration. > > maxThreads=1 and acceptCount=1 > > Then I send 2 concurrent requests from 2 clients and both were > served! I would expect both to be served: one request was served immediately (maxThreads=1) and one was queued (acceptCount=1). When the first request was completed, the second one came out of the queue and was served. If you had acceptCount="0" (which may or may not be legal for your TCP/IP stack) or you had sent 10 simultaneous connections, I would have expected at least some of them to be dropped with a connection error (assuming that they really are simultaneous and the response time is long enough to cover any variance in the connection-attempt time). Please provide more details about your test setup. > I was expecting that one would get a network failure! Woah, you thought you'd take-down your network? You must be running some shaky hardware. > I even tried maxThreads=0 and still the clients were served! How is > this possible? maxThreads="0" is an illegal configuration. Are you sure Tomcat started properly? Tomcat 6+ uses an Executor whether you configure one of not, and the StandardThreadExecutor simply passes the maxThreads value off to Java's ThreadPoolExecutor, which will throw IllegalArgumentException if maxThreads is 0. - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with undefined - http://www.enigmail.net/ iEYEAREIAAYFAlD26OcACgkQ9CaO5/Lv0PCgLQCffw+xQflDLr4Ps8vYkQkcXUYw EZ0AoKU7bMkUJkmx21IgaRkNpQVV20dh =9xBW -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org