Experimental patch to support disk AIO on FreeBSD and Linux.
./configure --with-file-aio ...
nginx.conf:
location / {
aio on;
output_buffers 1 128k;
}
----------
Linux: at least 2.6.22 kernel is required. Probably, you need to enable
directio as well (otherwise kernel may fall back to synchronous IO,
however, I'm not sure):
location / {
aio on;
directio 1;
output_buffers 1 128k;
}
----------
FreeBSD: should work on 4+, however, 7.x is preferable: on 6.x the network
subsystem is GiantLock'ed if AIO is used.
Kernel must support AIO:
options VFS_AIO
or
kldload aio
Probably you need to tune the sysctls:
vfs.aio.max_aio_queue (default) 1024
vfs.aio.max_aio_queue_per_proc 256
vfs.aio.max_aio_per_proc 32
vfs.aio.max_aio_procs 32
You may diagnose load using
vfs.aio.num_queue_count
vfs.aio.num_aio_procs
If kernel AIO queue overflows then nginx fall back to synchronous IO.
--
Igor Sysoev
http://sysoev.ru/en/