(N)IO Frameworks in Java

In this post, I have tried to briefly capture list of available Java IO application frameworks. IO Frameworks reduces the development time by providing additional features over the bare-bone IO API’s provided with Java.

Here is the definition I have used for the Framework

An (N)IO Framework is a library, that provides easy to use API by shielding low level complexity of IO and provides rich and reusable API’s to create robust and scalable Networking Applications“.

A key point here is, only complexity is reduced, the power of low level API’s is still available.

Have been using Apache MINA for a while, and found some similar and powerful frameworks. The idea is to share the result of searches. I don’t intent to compare them on their performances or features. The text for the frameworks have been picked from the respective websites.

  • Apache MINA   – MINA (Multipurpose Infrastructure for Network Applications) is a network application framework which helps users develop high performance and high scalability network applications easily.
  • xSockets – xSocket is a lightweight java nio-based server framework to build high performance, high scalable, multithreaded servers. It supports writing synchronous and asynchronous client-side applications as well as server-side applications in a very intuitive way  
  • Grizzly – The Grizzly framework has been designed to help developers to take advantage of the Java™ NIO API. Grizzly goals is to help developers to build scalable and robust servers using NIO.
  • Netty – Netty is a NIO client server framework which enables quick and easy development of network applications such as protocol servers and clients. It greatly simplifies and streamlines network programming such as TCP/IP socket server
There are a few others, have picked up the popular ones. 

6 thoughts on “(N)IO Frameworks in Java

  1. I would be very interested in a comparison between these libraries, as their functionality seem to be overlapping a lot. I’m not interested in any standard protocol implementations as I will be writing a custom protocol, basically I just need easy-to-use, robust and fast sockets communication (TCP and possibly UDP).

  2. I too would like to see a better comparison of the various NIO frameworks especially since this is such an interesting space to follow.

    To add my $0.02:

    Apache MINA – I’m a contributor to this project so it is the framework I am most familiar with. I would say that MINA is the easiest to use. MINA certainly scales well but I wouldn’t say that it performs well. My own experiments show that Netty performs much better than MINA (especially for clients, more on this later) and scales just as well if not better than MINA. Since Trustin left the MINA project to work on Netty, MINA development has slowed to a snail’s pace.

    xSockets – I have not used xSockets so I can’t really comment.

    Grizzly – Incredibly complicated. It took me a long time to wrap my head around what each Grizzly component is doing and how to leverage it. Grizzly 2.0 looks like it’s getting easier to use and is starting to looking a little more like MINA/Netty. This is a good thing, IMO. Grizzly was obviously initially designed for building a web server so it lacks some of the flexibility you might get with MINA or Netty. Performance has been Grizzly’s strength. Jean-francois Arcand has published multiple benchmarks showing how well Grizlly performs and scales doing HTTP.

    Netty – In my opinion, Netty 3.0 has the most promise of the Java NIO frameworks. It still doesn’t have a GA release but the release candidates have so far been solid. The Netty API is extremely flexible and a pleasure to use. The API is slightly more complex than MINA but not by much. The added flexibility of Netty makes up for the added complexity. Additionally, the latest benchmarks on the Netty website seam to indicate the Netty is the new performance champion, https://www.jboss.org/netty/performance.html.

    I have been using MINA and Netty 3.0 for my Asynchronous Database Connectivity in Java (ADBCJ) project, http://adbcj.org. Netty is a far better option for building asynchronous clients. In MINA, all sends happen in dedicated I/O threads. In Netty, a send can happen in the calling thread if the write buffer is not full. This feature alone improves performance of small sends dramatically (by more than 20% in many of my tests.)

    I would love to see some MINA AsyncWeb (both NIO and APR), Grizzly, and Netty (once it gets an HTTP protocol handler) performance and scalability comparisons. Maybe I should stop be lazy and do them myself. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.