-BEGIN PGP SIGNED MESSAGE-
On 10/11/17 8:56 AM, Saurav Sarkar wrote:
> I have got a basic question related to usage of Async servlet with
> tomcat NIO connector.
> I want to use Async servlet with Non Block I/O as per servlet spec
> Such that the http worker threads are released and the container
> threads won't be sitting idle for I/O operations too.
> I am on Tomcat 7. As i understand the default tomcat connector
> (BIO) is a blocking one and is on a thread per connection model. I
> am not clear on whether using async Non Blocking I/o in servlets
> won't suffice ? Won't the http worker threads be released here or
> will it be held for the lifetime of the connection ?
You can't effectively use BIO with async, at least not the way you
actually want to use it. You should switch to NIO if you want to use
> NIO connector will use request per threads or allocate threads
> when processing is required .Will using NIO selector only release
> the http worker threads if it is used in conjunction with
> Asynchronous Non blocking I/O servlets ?
That depends upon what you mean by "release" and, specifically, /when/
they are released.
With the BIO connector, HTTP keepalives can tie-up a connector up to
the keepAliveTimeout without accomplishing any useful work. This
happens ALL THE TIME -- clients make a keepalive request and then
never bother to close their connection cleanly. So the server wastes
thread-time waiting for another request which never comes.
The NIO connector (and APR connector) puts the connection into an I/O
selector and waits for an interrupt from the OS/JVM while the
request-processor thread goes back into the thread pool.
When doing servlet-async and Websocket, things get ... more complicated.
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
-END PGP SIGNATURE-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org