I was reading about "Tornado Web Server". It says that it is non-blocking web server. Is there any non-blocking server for java web app ?
Java EE provides nonblocking I/O support for servlets and filters when processing requests in asynchronous mode. The following steps summarize how to use nonblocking I/O to process requests and write responses inside service methods. Put the request in asynchronous mode as described in Asynchronous Processing.
However, Tomcat also supports Non-Blocking I/O. It is said that it supports near 13,000 simultaneous requests in NIO mode. Still, there is a limit. The acceptCount attribute defines the maximum number of HTTP connections that will be put in a queue while there is no free connection available to serve.
Non-blocking I/O. Blocking IO wait for the data to be write or read before returning. Java IO's various streams are blocking. It means when the thread invoke a write() or read(), then the thread is blocked until there is some data available for read, or the data is fully written.
The primary features of Java NIO are: Java NIO is an asynchronous IO or non-blocking IO. For instance, a thread needs some data from the buffer. While the channel reads data into the buffer, the thread can do something else. Once data is read into the buffer, the thread can then continue processing it.
You're thus looking for a Java servletcontainer/applicationserver which supports NIO (Non Blocking IO).
Pretty much all of them supports NIO: Apache Tomcat, JBoss AS, Oracle Glassfish, etcetera. On some of them (e.g. Apache Tomcat), you've to make some configuration changes first (see also its HTTP connector documentation with regard to NIO). Glassfish uses under the covers Grizzly as NIO implementation of the HTTP connector.
As to which one to choose, that depends on what parts provided by the huge Java EE 6 API you'd like to utilize. If it's just JSP/Servlet, then Tomcat suffices. If you need a bit more than just JSP/Servlet, the Glassfish Web Profile may suffice. If you'd like to utilize the entire Java EE 6 API, then go ahead with JBoss AS or Glassfish Full Platform.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With