X

An Oracle blog about Java Technology

Non-blocking I/Os in Servlet 3.1

David Delabassee
Software Evangelist

With the advent of platforms and frameworks such as Node.js,
Vert.x, ... and more generally the rise of the Event-driven programming paradigm,
asynchronous non-blocking I/Os are becoming more and more important in today's web applications.

Prior to Servlet 3.0, Servlet were synchronous. Servlet 3.0
(part of Java EE 6) added support for asynchronous request processing but only with
‘traditional’ I/Os (i.e. blocking I/Os) but this approach can sometime limit the
scalability of an application.

The support for non-blocking I/Os has been
added for Asynchronous Servlet in Servlet 3.1 (JSR 340 - part of Java EE 7). The net result is that the number of connections that can
simultaneously be handled by the Servlet Container is greatly increased. This
improves the resources utilization and the overall Web Container scalability.

It should be mentioned that other features haven added to the Servlet 3.1 such as support for the HTTP 1.1 Upgrade Mechanism. This new capability is used, for example, by the WebSocket
API (JSR 356) to upgrade an existing HTTP connection to a TCP based WebSocket
connection. In Servlet 3.1, the HTTP Upgrade Mechanism can also use
non-blocking I/Os.

This article and this JavaOne session explains how asynchronous non-blocking I/Os in Servlet 3.1 The JavaOne session also covers the HTTP
Upgrade mechanism and the other additions to the Servlet 3.1 API (various
security enhancements and other miscellaneous features).

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha
Oracle

Integrated Cloud Applications & Platform Services