Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Non-blocking Web Server for java

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 ?

like image 372
Vivek Goel Avatar asked Feb 20 '11 17:02

Vivek Goel


People also ask

Does Java have non-blocking IO?

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.

Is Tomcat not blocking?

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.

Is Java blocking or nonblocking?

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.

How does non-blocking IO work in Java?

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.


1 Answers

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.

like image 75
BalusC Avatar answered Oct 06 '22 18:10

BalusC