Hi,

I've been working on porting a NIO2 connector that was originally developed
for JBoss AS by Nabil Benothman (an intern at Red Hat). Due to the very
different connector structure in Tomcat and my preference for basing it on
the existing NIO1 connector, it is mostly new code, though.

So I would now like to contribute this in trunk as a new experimental
connector. It should have feature parity with the NIO1 connectors. Of
course, while the basics are in, it will need some time to pass the
testsuite, fix issues, improve stability, etc.

Coyote version number could be moved up to 2.0 with this addition along
with all the connector refactorings that Mark did in trunk.

The code is there (rebased to the current trunk):
https://github.com/rmaucher/tomcat

A quick NIO2 (the API) presentation.

Pros:
- Significantly faster, although the API looks slower by design
- Resources friendly
- Seemingly trivial to use
 - Polling is neatly hidden away
- Thread pool is also neatly hidden away
- Per operation timeouts
- Read/Write is symmetric
- Trivial blocking IO

Cons:
- No real non blocking IO
- No concurrency allowed [for the socket impl of NIO2] although the API
looks concurrent
- Simplicity is sometimes misleading, the API doesn't provide some tools
for the needed synchronization, check pending operations and their possible
optimizations
- SSL is not integrated any better than with NIO1, it is still SSLEngine
which leads to creating the obligatory "AsynchronousSSLSocketChannel"
wrapper class yourself
- No real sendfile

Comments ?

Rémy

Reply via email to