On Thu, Jul 10, 2008, Valery Kholodkov wrote: > It is modularized in the same way as libevent itself, despite the fact > that there are only few modules for now: aio_posix and aio_posix_kqueue > (aio_linux is broken). I principally considered to make AIO modules > controllable via options, this is not difficult. I think it is a good > thing to advance first, since I expect a request from list to be able to > switch off AIO completely, because not many platforms support it.
See, the interesting bit with POSIX AIO isn't just the disk IO, its that you can do potentially intersting network IO with it. FreeBSD's POSIX AIO implementation (which is implemented in-kernel) allows for copy-free network IO in some restricted circumstances. <slight rant> The trouble is it changes what people "expect" from a UNIX network IO API. Traditionally (including libevent's event_* stuff) its just event notification with the reads/writes being done in-line - and that limits how much you can do with the buffers passed into read/write. Using a POSIX AIO'ish way (including lio_listio for a kind of scatter-gather interface) which requires the source/destination user-space buffer to stay allocated and valid until the operation is completed (successful, failure or cancellation) makes things slightly more complicated but it means the kernel has the oppertunity to do interesting copy-free network IO in some cases (specifically - writes should be easy to do scatter-gather; reads not so much). Of course, people who have coded up network applications in Windows know this - its how ReadFile / WriteFile works :) Personally, I'm moving Squid's internals over to use an abstracted set of scatter/gather IO calls much like IOCP and POSIX AIO, but with a differerent threading model (not the IOCP type worker thread pool, more thread-per-CPU) with seperate threads for disk IO if the platform doesn't support kernel POSIX AIO. It seems the most portable and perfoming abstraction for writing "stuff" on top of - you can map normal read/write syscalls into a POSIX AIO style organisation, but not vice versa.. libevent is doing something similar in -trunk, but users can still use traditional event_* calls to schedule IO readiness. It also makes some stuff like SSL better. Hands up if you have dislike for the SSL READ_NEEDS_WRITE and WRITE_NEEDS_READ which has all the oppertunities to cause strange behaviour under load.. :) </slight rant> Adrian _______________________________________________ Libevent-users mailing list Libevent-users@monkey.org http://monkeymail.org/mailman/listinfo/libevent-users