Back to Search Start Over

High-Performance I/O With Java NIO.

Authors :
Pontarelli, Brian
Source :
Dr. Dobb's Journal: Software Tools for the Professional Programmer. Sep2005, Vol. 30 Issue 9, p32-39. 6p. 2 Charts.
Publication Year :
2005

Abstract

This article discusses how Orbitz used native input/output (NIO) to increase performance and stability by replacing an older standard input/output (I/O) implementation. The Orbitz.com application handles concurrent user requests by allowing each request to be performed in a separate thread. These threads, called execute threads, can be configured such that each request is handled by a new thread or by a thread from a thread pool. To guarantee timeouts for I/O operations, it employed a separate thread to perform the I/O operations. A timeout is specified when the join method is called to ensure that the execute threads do not wait forever for an IOThread to complete. The NIO package added to Java 1.4 offers Java developers the ability to perform true nonblocking I/O and guarantee timeouts for I/O operations. It also works with low-level operating-system constructs to increase performance and reduce latency. In addition, it provides the ability to monitor multiple I/O operations concurrently, also known multiplexing. Because the NIOWorker thread is a separate thread that handles all the I/O operations, execute threads must add their work and then wait for the NIOWorker thread to process it. Therefore, the NIOWorker class has one method that forces the execute threads to wait, and a second method that actually adds the work. One major pitfall to be aware of is that one should always use multiplexed NIO.

Details

Language :
English
ISSN :
1044789X
Volume :
30
Issue :
9
Database :
Academic Search Index
Journal :
Dr. Dobb's Journal: Software Tools for the Professional Programmer
Publication Type :
Periodical
Accession number :
17869049