Asankha, What you are referring to is the "backlog" of a Socket. That is the number of half-open / unaccepted connections that is queued by the OS before sending RSTs for any more SYNs.
See java.net.Socket bind() method that accept the backlog parameter. Unfortunately you can not change this property after binding. I suggest that we should provide the backlog as a parameter. But actually a more flexible (and more intrusive) way is to make a ServerSocketChannel factory or at least a factory method, and do away with the prepareSocket call. That way even more aspects of the underlying implementation are tunable to the caller and the HttpNIO code doesn't need to be changed for them. Think of a SCTP implementation for instance :-) Thanks. Ortwin On 03.02.2010 05:13, Asankha C. Perera wrote: > Hi All > > With some recent load testing in an environment where requests are > queued and handled by a worker pool, I've seen that the NIO listener > will accept any number of connections - possibly even more than what the > worker pool (or the backend server to which they are forwarded) could > handle. > > Thus I would like to impose a limit on the connections handled in a > graceful way - e.g. without refusing connections with a TCP RST - but by > not accepting the connection - so that the client can retransmit the SYN > again and try to connect. Is this the correct way to handle such load, > or should the server reply with a HTTP 503 (Service Unavilable) with a > "Retry-After" header? Any pointers and comments are very much appreciated > > Tomcat 6 seems to refuse connections after the "acceptCount" is reached > [1] - but I think that might cause a load balancer in front to assume > the node is down - am I wrong? > > thanks > asankha > > [1] http://tomcat.apache.org/tomcat-6.0-doc/config/http.html > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > -- [web] http://www.odi.ch/ [blog] http://www.odi.ch/weblog/ [pgp] key 0x81CF3416 finger print F2B1 B21F F056 D53E 5D79 A5AF 02BE 70F5 81CF 3416 --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
