Hi Chris
First, evidently, "acceptCount" almost does not appear in the Tomcat
source. It's real name is "backlog" if you want to do some searching.
It's been in there forever.
Yes, I found it too; but saw that it didn't perform what an 'end user'
would expect from Tomcat.
Second, all three connectors (APR, JIO, NIO) (through their
appropriate Endpoint implementation classes) faithfully configure the
backlog for their various sockets:
...
So, barring some JVM bug, the backlog is being set as appropriately as
possible.
Although the backlog is set, you cannot depend on it alone to make
Tomcat behave more gracefully when under too much load. As explained in
my previous blog post, this is not because of a defect of Tomcat - but
the way things work in reality, causing TCP and HTTP connections to be
established, requests to be [partially]sent and subsequently face hard
TCP resets.
Third is the notion of playing with OP_ACCEPT on a selector. I'm no
NIO expert, here, but I don't understand why adding OP_ACCEPT to the
SelectionKey would change anything, here: the socket handles the
backlog, and the behavior of the selector shouldn't affect the OS's
TCP backlog. Doing so would be incredibly foolish: forcing the
application to react to all incoming connections before they went into
the backlog queue would essentially obviate the need for the backlog
queue in the first place.
If you can suggest something specific, here, I'd certainly be
interested in what your suggestion is. So far, what I'm hearing is
that "it works with HttpComponents" but I have yet to hear what "it"
is. Are you saying that, basically, NIO sockets simply do not have a
backlog, and we have to fake it using some other mechanism?
Sure, I've written a pure Java example [1] that illustrates what I am
proposing. It illustrates how you could turn off accepting new
connections, and resume normal operations once load levels returns to
normal.
[1]
http://esbmagic.blogspot.com/2012/11/how-to-stop-biting-when-you-cant-chew.html
regards
asankha
--
Asankha C. Perera
AdroitLogic, http://adroitlogic.org
http://esbmagic.blogspot.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org