Help with AIO
Hagai Avrahami
hagaia at qwilt.com
Thu Sep 15 14:21:44 UTC 2011
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; <---------------------------------------------------------??
if (n == NGX_EAGAIN) {
return ngx_read_file(file, buf, size, offset);
}
ngx_log_error(NGX_LOG_CRIT, file->log, n,
"io_submit(\"%V\") failed", &file->name);
if (n == NGX_ENOSYS) {
ngx_file_aio = 0;
return ngx_read_file(file, buf, size, offset);
}
return NGX_ERROR;*
// I think it should be
//----------------------------------------------------------------------------
*n = io_submit(ngx_aio_ctx, 1, piocb);
if (n == 1) {
ev->active = 1;
ev->ready = 0;
ev->complete = 0;
return NGX_AGAIN;
}
if (n == 0)
{
ngx_log_error(NGX_LOG_CRIT, file->log, 0,
"io_submit(\"%V\") failed - 0 - I/O request blocks",
&file->name);
return NGX_ERROR;
}
else
{
n = errno;
}
* * if (n== NGX_EAGAIN) {
return ngx_read_file(file, buf, size, offset);
}
ngx_log_error(NGX_LOG_CRIT, file->log, n,
"io_submit(\"%V\") failed", &file->name);
if (n== NGX_ENOSYS) {
ngx_file_aio = 0;
return ngx_read_file(file, buf, size, offset);
}
return NGX_ERROR;*
//----------------------------------------------------------------------------
your help will be appreciated
Thanks
Hagai
On Tue, Sep 6, 2011 at 9:33 AM, Maxim Dounin <mdounin at mdounin.ru> wrote:
> Hello!
>
> On Tue, Sep 06, 2011 at 01:21:00AM +0300, Hagai Avrahami wrote:
>
> > Hi
> >
> > I configured Nginx with *aio *mode *on *and 1 *worker process*
> > In benchmarking I saw limit of 1024 concurrent sessions even configured
> to
> > 4096 *worker connections*
>
> Sure it's not limitation of the benchmarking tool you use? Most
> tools out there use select() and hence limited to 1024
> concurrent connections.
>
> > When I looked in the source code I could see that io_setup is called
> with
> > fix value of 1024 max events
> > can anyone please explain me the hard coded limit
> > Is it OK to change it or it is derived from other limit I am not aware of
> > any help will be appreciated
>
> io_setup() maxevents is a limit on number of aio requests allowed
> to be submitted simulteneously; if nginx hits this limit, it will
> fallback to normal blocking read.
>
> If you are going to change it, make sure to keep total for all
> processes lower than /proc/sys/fs/aio-max-nr.
>
> Maxim Dounin
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
--
*Hagai Avrahami*
Qwilt | Work: +972-72-2221644| Mobile: +972-54-4895656 |
hagaia at qwilt.com<yoav at qwilt.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20110915/bb77057f/attachment.html>
More information about the nginx
mailing list