Adding Linux ASYNC I/O to libev
kostja.osipov at gmail.com
Thu Mar 10 08:02:28 CET 2011
* Marc Lehmann <schmorp at schmorp.de> [11/03/10 09:52]:
> On Wed, Mar 09, 2011 at 01:04:55PM +0300, Konstantin Osipov <kostja.osipov at gmail.com> wrote:
> > Sorry if it was raised before, but are there plans to
> > add support for Linux asynchronous file I/O to libev loop?
> Does linux (the kernel) have asynchronous file I/O nowadays - do you have
> any pointers to "linux async file I/O"?
> Last I looked, all aio functionality was still in userspace (glibc), with
> much more overhead than libeio (and there is experimental and broken
> kernel support that requires special (non-posix) fd's to work and has lots
> of other limitations).
AFAIU there is now a POSIX implementation in the kernel:
> And then there is the problem of it often being slower than using threads.
That I can't say for sure, but a mere switch to laio on Linux in
MySQL/InnoDB 5.5 gave a measurable increase in performance.
Asynchronous IO was used in MySQL before, but not on Linux, so
it's hard to say whether the performance improvement came from the
switch per se or from laio.
> > While it's not done, what's the canonical way to integrate libeio
> > into libev loop?
> the simplest "canonical" way is to send to an ev_async watcher from the
> want_poll callback, then in the async watcher callback, call eio_poll
> until it returns 0. for the done_cb argument you can pass 0, as the async
> watcher does the necessary logic for you (it's possible to optimise a bit
> more out of this).
Thank you, I will need to look a bit closer before I write
back with more questions :)
More information about the libev