You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by shrikant patel <sh...@gmail.com> on 2010/12/22 17:31:40 UTC
Tomcat 6.0.18 related NIO questions.
We are using tomcat connector as follows -->
<Connector connectionTimeout="500000" port="8080" protocol="HTTP/1.1" ...
Based on the documentation we are using the blocking call, right? So the
servlet thread is blocked for IO while reading request and writing response.
In case we want to use NIO, we have to specify protocol as
org.apache.coyote.http11.Http11NioProtocol - non blocking Java connector,
org.apache.coyote.http11.Http11AprProtocol - the APR connector.
I have basic understanding of NIO. My understanding is that tomcat
internally use Java NIO to read the request into buffer. When complete
request is read then dispatch it to servlet for processing. That way each
servlet thread is not blocked on IO. Similarly in case of response, it get
response from servlet, keep buffering it and send it to client. This way
servlet is not completely blocked for entire duration of the response being
send to client.
Please let me know if this is correct.
Is there document in this regards you can point to get better understanding?
I have googled, i do get many article but about NIO in general nothing
specific to how tomcat handles it.
Thanks in Advance.
Shri
Re: Tomcat 6.0.18 related NIO questions.
Posted by Mark Thomas <ma...@apache.org>.
On 22/12/2010 16:31, shrikant patel wrote:
> We are using tomcat connector as follows -->
> <Connector connectionTimeout="500000" port="8080" protocol="HTTP/1.1" ...
>
> Based on the documentation we are using the blocking call, right?
It depends. Probably the BIO connector but it could also bee the APR
connector. The logs will tell you which.
> I have basic understanding of NIO. My understanding is that tomcat
> internally use Java NIO to read the request into buffer. When complete
> request is read then dispatch it to servlet for processing. That way each
> servlet thread is not blocked on IO. Similarly in case of response, it get
> response from servlet, keep buffering it and send it to client. This way
> servlet is not completely blocked for entire duration of the response being
> send to client.
> Please let me know if this is correct.
No. That is wrong. There is more (simulated) blocking I/O happening than
you think.
> Is there document in this regards you can point to get better understanding?
Bottom of this page.
http://tomcat.apache.org/tomcat-6.0-doc/config/http.html
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat 6.0.18 related NIO questions.
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Shri,
On 12/22/2010 11:31 AM, shrikant patel wrote:
> We are using tomcat connector as follows -->
> <Connector connectionTimeout="500000" port="8080" protocol="HTTP/1.1" ...
Aside from the comments made by others, I highly recommend an upgrade to
6.0.29: 6.0.18 is over 2 years old and many improvements have been made
- -- even to the connectors themselves.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk0SM60ACgkQ9CaO5/Lv0PBd+ACgo3giUiGcsdWOaosK9GpAWvcF
yi0Ani6zwt8X9i2Gn3We5OHxlqlvalaJ
=kaMC
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat 6.0.18 related NIO questions.
Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
hi shrikant,
there are many benefits of NIO in a tomcat 6, the main being there is no longer a thread-per-connection limit.
Note in Tomcat 7, even with the blocking connector, you can have more connections than threads.
The NIO connector will read your request headers in a non blocking fashion, it will also do SSL negotiation in a non blocking fashion, so
while this is taking place, you're not holding a thread waiting for a client response.
Same thing, if you use send file, then the NIO connector can download a file to more than one client using a single thread.
However, as soon as you enter a the HttpServlet.service method, all non blocking benefits are gone. Per the servlet specification, the same
thread is used executing this method, and that means, blocking. Even if you do inputstream.read or outputstream.write, and you use the NIO
connector, tomcat blocks these calls for you.
In Tomcat 7 (Servlet 3.0) you will be able to do a bit more async stuff using the async API, but in Tomcat 6, those features only exists
using the Comet interface.
best
Filip
On 12/22/2010 9:31 AM, shrikant patel wrote:
> We are using tomcat connector as follows -->
> <Connector connectionTimeout="500000" port="8080" protocol="HTTP/1.1" ...
>
> Based on the documentation we are using the blocking call, right? So the
> servlet thread is blocked for IO while reading request and writing response.
>
>
> In case we want to use NIO, we have to specify protocol as
> org.apache.coyote.http11.Http11NioProtocol - non blocking Java connector,
> org.apache.coyote.http11.Http11AprProtocol - the APR connector.
>
> I have basic understanding of NIO. My understanding is that tomcat
> internally use Java NIO to read the request into buffer. When complete
> request is read then dispatch it to servlet for processing. That way each
> servlet thread is not blocked on IO. Similarly in case of response, it get
> response from servlet, keep buffering it and send it to client. This way
> servlet is not completely blocked for entire duration of the response being
> send to client.
> Please let me know if this is correct.
>
> Is there document in this regards you can point to get better understanding?
>
> I have googled, i do get many article but about NIO in general nothing
> specific to how tomcat handles it.
>
> Thanks in Advance.
> Shri
>
>
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 10.0.1170 / Virus Database: 1435/3329 - Release Date: 12/21/10
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org