Nginx-ru mailing list archive (nginx-ru@sysoev.ru)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CentOS 5.5 + nginx + aio
>diff -u
]# diff -u -r nginx-0.8.50 nginx-0.8.50-patched/
diff -u -r nginx-0.8.50/src/core/ngx_output_chain.c
nginx-0.8.50-patched/src/core/ngx_output_chain.c
--- nginx-0.8.50/src/core/ngx_output_chain.c 2010-10-15
22:33:14.000000000 +0600
+++ nginx-0.8.50-patched/src/core/ngx_output_chain.c 2010-10-15
04:48:47.000000000 +0600
@@ -74,18 +74,18 @@
}
}
+#if (NGX_HAVE_FILE_AIO)
+ if (ctx->aio) {
+ return NGX_AGAIN;
+ }
+#endif
+
out = NULL;
last_out = &out;
last = NGX_NONE;
for ( ;; ) {
-#if (NGX_HAVE_FILE_AIO)
- if (ctx->aio) {
- return NGX_AGAIN;
- }
-#endif
-
while (ctx->in) {
/*
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_filter_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;
}
>grep alert /path/to/error.log
ïÞÅÎØ ÍÎÏÇÏ ÁÌÅÒÔÏ×. ëÕÓÏË:
2010/10/17 16:39:08 [alert] 18916#0: *159817 second aio post for
"file.mp4" while sending response to client, client: 77.244.215.40,
server: example.com, request: "GET file.mp4 HTTP/1.1", host:
"example.com"
2010/10/17 16:40:03 [alert] 18899#0: *113623 second aio post for
"file.mp4" while sending response to client, client: 212.142.93.180,
server: example.com, request: "GET file.mp4 HTTP/1.1", host:
"example.com"
Posted at Nginx Forum:
http://forum.nginx.org/read.php?21,105802,141500#msg-141500
_______________________________________________
nginx-ru mailing list
nginx-ru@xxxxxxxxx
http://nginx.org/mailman/listinfo/nginx-ru
|