CentOS 5.5 + nginx + aio

Panasonic1 nginx-forum на nginx.us
Пт Окт 15 15:55:44 MSD 2010


>А патчи точно применены, и новый nginx
запущен? 
Да, конечно. Новый nginx запускал через
restart.


>Покажите diff -u по отношению к
коробочной версии.

# diff -u nginx-0.8.50/ nginx-0.8.50-patched/ -r
Only in nginx-0.8.50-patched/src/core: ngx_output_chain.c.orig
diff -u -r nginx-0.8.50/src/http/ngx_http_copy_filter_module.c
nginx-0.8.50-patched/src/http/ngx_http_copy_filt                        
                                er_module.c
--- nginx-0.8.50/src/http/ngx_http_copy_filter_module.c 2010-05-14
18:18:44.000000000 +0600
+++ nginx-0.8.50-patched/src/http/ngx_http_copy_filter_module.c
2010-10-15 04:53:23.000000000 +0600
@@ -118,8 +118,10 @@
         ctx->filter_ctx = r;

 #if (NGX_HAVE_FILE_AIO)
-        if (ngx_file_aio && clcf->aio) {
-            ctx->aio_handler = ngx_http_copy_aio_handler;
+        if (ngx_file_aio) {
+            if (clcf->aio) {
+                ctx->aio_handler = ngx_http_copy_aio_handler;
+            }
 #if (NGX_HAVE_AIO_SENDFILE)
             c->aio_sendfile = (clcf->aio == NGX_HTTP_AIO_SENDFILE);
 #endif
@@ -156,6 +158,11 @@
             ngx_file_t            *file;
             ngx_http_ephemeral_t  *e;

+            if (r->aio) {
+                c->busy_sendfile = NULL;
+                return rc;
+            }
+
             file = c->busy_sendfile->file;
             offset = c->busy_sendfile->file_pos;

@@ -211,6 +218,8 @@

     r->main->blocked++;
     r->aio = 1;
+
+    ctx->aio = 1;
 }


diff -u -r nginx-0.8.50/src/http/ngx_http_request.c
nginx-0.8.50-patched/src/http/ngx_http_request.c
--- nginx-0.8.50/src/http/ngx_http_request.c    2010-07-05
19:35:20.000000000 +0600
+++ nginx-0.8.50-patched/src/http/ngx_http_request.c    2010-10-15
04:53:23.000000000 +0600
@@ -2218,17 +2218,17 @@
             return;
         }

-    } else {
-        if (wev->delayed || r->aio) {
-            ngx_log_debug0(NGX_LOG_DEBUG_HTTP, wev->log, 0,
-                           "http writer delayed");
+    }

-            if (ngx_handle_write_event(wev, clcf->send_lowat) !=
NGX_OK) {
-                ngx_http_close_request(r, 0);
-            }
+    if (wev->delayed || r->aio) {
+        ngx_log_debug0(NGX_LOG_DEBUG_HTTP, wev->log, 0,
+                       "http writer delayed");

-            return;
+        if (ngx_handle_write_event(wev, clcf->send_lowat) != NGX_OK) {
+            ngx_http_close_request(r, 0);
         }
+
+        return;
     }

     rc = ngx_http_output_filter(r, NULL);
@@ -2244,7 +2244,7 @@

     if (r->buffered || r->postponed || (r == r->main && c->buffered))
{

-        if (!wev->ready && !wev->delayed) {
+        if (!wev->delayed) {
             ngx_add_timer(wev, clcf->send_timeout);
         }

diff -u -r nginx-0.8.50/src/os/unix/ngx_linux_aio_read.c
nginx-0.8.50-patched/src/os/unix/ngx_linux_aio_read.c
--- nginx-0.8.50/src/os/unix/ngx_linux_aio_read.c       2009-11-05
19:12:30.000000000 +0600
+++ nginx-0.8.50-patched/src/os/unix/ngx_linux_aio_read.c      
2010-10-15 04:48:47.000000000 +0600
@@ -95,6 +95,10 @@
     n = io_submit(ngx_aio_ctx, 1, piocb);

     if (n == 1) {
+        ev->active = 1;
+        ev->ready = 0;
+        ev->complete = 0;
+
         return NGX_AGAIN;
     }

Posted at Nginx Forum: http://forum.nginx.org/read.php?21,105802,140935#msg-140935




Подробная информация о списке рассылки nginx-ru