ImperialViolet

Why POSIX AIO has such a schizophrenic time (29 Mar 2005)

The Linux AIO effort is doing pretty well. It now has kernel interfaces to handle the AIO calls and the performance is looking pretty good.

Talking about AIO is often an odd experience because people don't realise that it does a completely different job to asynchronous network IO. There are two utterly separate problems that AIO can solve:

  • High performance IO: giving the kernel better information about future IO requests thus allowing it to order them for better throughput etc.
  • Issuing IO requests without blocking.

Networking calls have always had a non-blocking option since Berkeley sockets. Filesystem IO has never had one for some reason. This leads to programs which either handle filesystem congestion very badly or by using IO worker threads to try and cope in an otherwise single-threaded program.

For an example of the first, try having an NFS mounted home directory when the network fails. Everything drops into disk-wait because all the filesystem calls block for many minutes.

Networking calls have always been non-blocking because everyone knows that network calls can take ages to complete. But with the relative speed of modern CPUs/Memory against disks (and certainly network based filesystems) we really need non-blocking file IO.

Sadly the POSIX AIO API only deals with the first problem. open, getdents etc calls still block.

So, kernel developers, quit tweaking little things. We want some real progress! Give us non-blocking file IO which works with epoll.

Update: Something I didn't make clear. Non-blocking support is a stronger feature than high-performance support. If a kernel has non-blocking filesystem support it implies that it has high-performance support too.