AIO and some advice needed.

Avinash Lakshman avinash.lakshman at gmail.com
Wed Nov 26 07:53:58 PST 2008


Hi All

I have been evaluating AIO and along the way I learnt that it goes a long to
help out the NCQ features that are available in today's SATA drives -
information can be found over here *
http://www.seagate.com/content/pdf/whitepaper/D2c_tech_paper_intc-stx_sata_ncq.pdf
*.

But there are some questions that I have and I am not quite sure what
approach is needed here. The whole idea behind NCQ is that one submits
multiple I/O requests to the I/O subsystem and NCQ does a very good job of
reordering the requests to minimize rotational and seek latency. Obviously
more requests can be submitted only if the application can keep submitting
asynchronously without blocking. Now AIO can be used in two modes:

(1) Submit the read/write request and then wait on the returned future
pointer - which looks like a synchronous read/write to me. It appears one
cannot take advantage of NCQ over here.
(2) Submit the read/write request and then handle the result in the
completion handler as opposed to blocking on a future pointer. This really
takes advantage of the NCQ features since the thread is not blocked and more
requests can be submitted to take advantage of the NCQ features.

If I were to use the latter how would one handle reads like the ones that
occur in our application:

(1) seek(position);
(2) readUTF() - read a key value.
(3) readInt() - size of the data associated with the data.
(4) .....

We need to perform little reads before we know what the result is. So far we
were doing buffered reads and then working with the data in to memory. To
convert this into true AIO w/o blocking the application thread, would
involve some convuluted programming. Is this the norm? Is my understanding
correct as far as the programming paradigm is concerned? Are there any
samples anyone could share with me that helps me understand this better?

Thanks
Avinash
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/nio-discuss/attachments/20081126/e7425c3f/attachment.html 


More information about the nio-discuss mailing list