|Posted on February 7, 2012 at 5:05 PM|
I lied. Datawire 2.0 will use primarily NIO, and here is why:
Sticking to pure blocking I/O would mean launching a new thread to go listen for protocol signals from each client. This is an issue primarily with scalability (not so much speed). For a P2P program such as Datawire, if a host decides he wants to have 20 people all in one lobby, that's 20 threads performing I/O operations at one time.... quite a bit of resource usage.
NIO enables me to have Datawire monitor all of the clients from one Thread and handle each client request far more efficiently through the use of Selectors.
So, the networking protocol and data engine will be NIO based. The file I/O may or may not be. I'm not totally sure right now. There will, however, be some traditional I/O still mixed in, as it often allows for much more maintainable and easy-to-work-with code.
Cause obviously you care about all of this right?