vector write/read
Alan Bateman
Alan.Bateman at Sun.COM
Thu Jun 19 09:40:59 PDT 2008
Tigran Mkrtchyan wrote:
> Hi,
>
>
> just want to ask why vector operations are not a part to nio?
>
> we are working on distributed storage and our users often know where
> data is (files are like small databases - header and records). We have
> our own protocol for it and extensions to posix IO api:
>
> typedef struct {
> off64_t offset;
> int len;
> char *buf;
> } iovec2;
>
> extern int dc_readv2(int, iovec2 *, int);
>
> Basically what it does is you give an array of buffers and for each
> buffer you provide an offset. It's very helpful when there is a lot of
> randomly distributed small records. If file system do not support it
> you can always fall back to 'classic' reads internally, but provide
> only classic API force other people to find some custom solutions.
Right, vector I/O is not currently supported, and for your example,
would require a sequence of reads (or you could use a thread pool to get
some parallelism or use AsynchronousFileChannel). I haven't seen many
requests for this but it may be worth considering. Off-hand, I don't
know if this is an area that has been standarized (the closest that
comes to mind is lio_listio in the real-time extensions when used in
wait mode).
-Alan.
More information about the nio-dev
mailing list