More NIO and IO performance results

I took the opportunity to create a standard IO client and server and performed some changes / optimizations on the Converted IO. The source is available at the usual place.

The testing environment is the same as the previous tests.

There are a total of four cases:

  • NIO Server, NIO Client
  • IO Server, IO Client
  • Converted IO Server, Converted IO Client
  • Converted IO w/ Selector Server, Converted IO Client

“NIO” means that the component was created using only NIO. “IO” uses the standard Java IO (from the java.net). “Converted IO” is an NIO wrapper to InputStream and OutputStream. The server with “Converted IO” uses a separate thread per client. The server with “Converted IO w/ Selector” uses a single thread for all clients and switches between them using an NIO Selector.

NIO Server, NIO Client IO Server, IO Client
Converted IO Server, Converted IO Client Converted IO w/ Selector Server, Converted IO Client

Analysis (see the previous tests for more analysis):

  • Standard IO performs slightly better (and with less variance) than NIO. This follows the standard claim that the use of a selector adds a bit of overhead (even more than that seen by using multiple threads). A future test should use many more clients to see if the overhead of a selector overcomes the overhead of context switching many threads.
  • The clean up of the Converted IO appears to have created a positive result. The difference between ~10.3 MB/s (NIO), ~11.1 MB/s (IO) and ~9.8 MB/s (Converted IO) (~4% and ~11%, Converted IO to NIO and Converted IO to IO, respectively) is much better than the previous difference of ~20%.
  • The Converted IO using a Selector has a similar trend as before: large variance in throughput and much lower throughput. More investigation is needed.

A special thanks goes out to Carlo Segre for use of the cluster.

Link-back to main entry: NIO and SSL.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s