One of my big complaints with Apache MINA is the high latency that’s incurred when sending data. MINA uses a set of I/O threads to handle reads and writes. This is typical of many non-blocking I/O frameworks.

Netty is much more clever than MINA. In Netty, when you make a call to send data and the send queue is empty, Netty will just send the data. We are using non-blocking I/O so the call will still be asynchronous. If the send queue is not empty, Netty will queue up the data to be sent in much the same way that MINA does sends. The Netty approach is much faster.

Using ADBCJ I conducted a simple performance test comparing MINA and Netty. The test runs 100 simple select SQL queries against MySQL that each return a single string. Each test was run 100,000 times.

Mean Stdev
MINA 618,912,430.60ns 104,509,066.50ns
Netty 563,756,985.70ns 104,440,106.73ns

As you can see, Netty is significantly faster. In all the tests I’ve run so far, Netty has been faster.

To say I’m please with Netty would be an understatement.