-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Saurav,

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 
> https://docs.oracle.com/javaee/7/tutorial/servlets013.htm?lipi=urn%3Al
i%3Apage%3Ad_flagship3_pulse_read%3BmL0Q5Y7ESTy4lpYPU%2Br77w%3D%3D
>
>  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
servlet-async.

> 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.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlngMdMACgkQHPApP6U8
pFjwiw//UeN1W08AId+OcVUc2ZMnzZZZJLnu6RhY+yO50avZx3PhvzGxrHZTfBRD
FFRJRBOCo/1TFacQxUjFXr4Q9tkdcABcN6cVj6f7tJh4S55/jxEeHkg8UGNQe31V
9N6GpUIzRq/WuDFJQRfwJnpOQRVs+DXVIrWWD8RqQ6BooHkt2mUl0u7oYRxcLcQ1
SD8tEK1O1LiJ1gwNWs5Cx1d7s/6mE2tSxKvKH94yr1MvfdChj51vrc7JI3+gfdwa
V6FWItVoIuG4rNqFsthaKiXswvqyGC+gzPG9Jn7aEh0Xd2rzCAX+E9GMM7aKMHEL
QOu+gFm897eRhL4ueBDBxl3MY1R/xD5JEIDeuO82gbmM8xcm7sSqWs2TOazFC5xs
JOdo52xS38RHgRf+eSQ7+KMmZYznYbUscJMokTHYWU/twC7tSzmO4rYB2EEPNTEB
czNyxv4MbWCaQjOunYeFMp2byEFmLyLu2e+jBDPdmPsjMgpduQ35E4spfaYRaCc0
5J8HRaQ4s0amy6b9s/j95pFvYVRlaPRN7ebNMtT/BhoakKXk+ugpNsnCI21zChAJ
aKOdPzb5RU90Qm7mDXeRFqggfI5S1w507WlQZp6bZG6WZ2oz0ykF87WHHQP8C5F4
AvSvTe32zDpmCt0rS7+VgTGBNL/VGLv8r8S/0eLjldA0LDASkTA=
=vSrb
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to