<div dir="ltr">Hi<br><br>When benchmarking AIO read, I reached more than 1024 concurrent Async IO -<br>1. I saw a weird error log<br>2. Nginx did not fallback to regular blocking read<br><br>I looked on the source code -- src/os/unix/ngx_linux_aio_read.c line:105<br>
and I think there is a problem in errno handling<br><br>// Current Code<br>//----------------------------------------------------------------------------<br> <b>n = io_submit(ngx_aio_ctx, 1, piocb);<br><br> if (n == 1) {<br>
ev->active = 1;<br> ev->ready = 0;<br> ev->complete = 0;<br><br> return NGX_AGAIN;<br> }<br><br> n = -n; <---------------------------------------------------------??<br><br>
if (n == NGX_EAGAIN) {<br> return ngx_read_file(file, buf, size, offset);<br> }<br><br> ngx_log_error(NGX_LOG_CRIT, file->log, n,<br> "io_submit(\"%V\") failed", &file->name);<br>
<br> if (n == NGX_ENOSYS) {<br> ngx_file_aio = 0;<br> return ngx_read_file(file, buf, size, offset);<br> }<br><br> return NGX_ERROR;</b><br><br><br><br> // I think it should be <br>//----------------------------------------------------------------------------<br>
<b>n = io_submit(ngx_aio_ctx, 1, piocb);<br>
<br>
if (n == 1) {<br>
ev->active = 1;<br>
ev->ready = 0;<br>
ev->complete = 0;<br>
<br>
return NGX_AGAIN;<br>
}<br><br> if (n == 0)<br> {<br> ngx_log_error(NGX_LOG_CRIT, file->log, 0,<br> "io_submit(\"%V\") failed - 0 - I/O request blocks", &file->name);<br><br> return NGX_ERROR;<br>
}<br> else<br> { <br> n = errno;<br> }<br><br></b> <b> if (n== NGX_EAGAIN) {<br> return ngx_read_file(file, buf, size, offset);<br> }<br><br> ngx_log_error(NGX_LOG_CRIT, file->log, n,<br>
"io_submit(\"%V\") failed", &file->name);<br><br> if (n== NGX_ENOSYS) {<br> ngx_file_aio = 0;<br> return ngx_read_file(file, buf, size, offset);<br> }<br><br>
return NGX_ERROR;</b><br>//----------------------------------------------------------------------------<br><br><br>your help will be appreciated<br>Thanks<br>Hagai<br><br><div class="gmail_quote">On Tue, Sep 6, 2011 at 9:33 AM, Maxim Dounin <span dir="ltr"><<a href="mailto:mdounin@mdounin.ru" target="_blank">mdounin@mdounin.ru</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello!<br>
<div><br>
On Tue, Sep 06, 2011 at 01:21:00AM +0300, Hagai Avrahami wrote:<br>
<br>
> Hi<br>
><br>
> I configured Nginx with *aio *mode *on *and 1 *worker process*<br>
> In benchmarking I saw limit of 1024 concurrent sessions even configured to<br>
</div>> 4096 *worker connections*<br>
<br>
Sure it's not limitation of the benchmarking tool you use? Most<br>
tools out there use select() and hence limited to 1024<br>
concurrent connections.<br>
<div><br>
> When I looked in the source code I could see that io_setup is called with<br>
> fix value of 1024 max events<br>
> can anyone please explain me the hard coded limit<br>
> Is it OK to change it or it is derived from other limit I am not aware of<br>
> any help will be appreciated<br>
<br>
</div>io_setup() maxevents is a limit on number of aio requests allowed<br>
to be submitted simulteneously; if nginx hits this limit, it will<br>
fallback to normal blocking read.<br>
<br>
If you are going to change it, make sure to keep total for all<br>
processes lower than /proc/sys/fs/aio-max-nr.<br>
<br>
Maxim Dounin<br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr"><p><font color="#000000"><b>Hagai Avrahami</b></font><br>
<font color="#000000">Qwilt | Work: <a href="tel:%2B972-72-2221644" value="+972722221644" target="_blank">+972-72-2221644</a>| Mobile: <a href="tel:%2B972-54-4895656" value="+972544895656" target="_blank">+972-54-4895656</a> | </font><a href="mailto:yoav@qwilt.com" rel="nofollow" target="_blank">hagaia@qwilt.com</a></p>
</div><br>
</div>