Help with AIO
Igor Sysoev
igor at sysoev.ru
Fri Sep 16 14:10:02 UTC 2011
On Fri, Sep 16, 2011 at 02:39:07PM +0400, Igor Sysoev wrote:
> On Thu, Sep 15, 2011 at 04:21:44PM +0200, Hagai Avrahami wrote:
> > Hi
> >
> > When benchmarking AIO read, I reached more than 1024 concurrent Async IO -
> > 1. I saw a weird error log
> > 2. Nginx did not fallback to regular blocking read
> >
> > I looked on the source code -- src/os/unix/ngx_linux_aio_read.c line:105
> > and I think there is a problem in errno handling
> >
> > // Current Code
> > //----------------------------------------------------------------------------
> > *n = io_submit(ngx_aio_ctx, 1, piocb);
> >
> > if (n == 1) {
> > ev->active = 1;
> > ev->ready = 0;
> > ev->complete = 0;
> >
> > return NGX_AGAIN;
> > }
> >
> > n = -n; <---------------------------------------------------------??
>
> Thank you, this is a bug. I confused this with _syscall(2).
Linux AIO fixed in these two commits:
http://trac.nginx.org/nginx/changeset/4130/nginx
http://trac.nginx.org/nginx/changeset/4131/nginx
Also I'm going to introduce the directive:
events {
worker_aio_events 100;
}
to set how much aio events worker may request to the kernel.
I'm going to set default value to 32 events per worker.
Currenly this value is hardcoded to 1024 and it seems it is too large,
since default /proc/sys/fs/aio-max-nr value is 65536 and this means
that you can run no more than 64 workers.
--
Igor Sysoev
More information about the nginx
mailing list