Hi
When benchmarking AIO read, I reached more than 1024 concurrent Async IO
- I saw a weird error log
- 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 D. [email protected] wrote:
nginx mailing list
[email protected]
nginx Info Page
–
Hagai A.
Qwilt | Work: +972-72-2221644| Mobile: +972-54-4895656 |
[email protected][email protected]