You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by st...@apache.org on 2002/07/07 18:35:20 UTC
cvs commit: httpd-2.0/modules/http http_core.c
stoddard 2002/07/07 09:35:20
Modified: modules/http http_core.c
Log:
Optimize reading keep-alive requests with APR_INCOMPLETE_READ. In the
profiling I've done, the read() in apr_read() would always fail with
EAGAIN. This will send the thread directly to select to wait for the
next request.
Revision Changes Path
1.306 +10 -2 httpd-2.0/modules/http/http_core.c
Index: http_core.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/http/http_core.c,v
retrieving revision 1.305
retrieving revision 1.306
diff -u -r1.305 -r1.306
--- http_core.c 28 Jun 2002 08:40:24 -0000 1.305
+++ http_core.c 7 Jul 2002 16:35:20 -0000 1.306
@@ -274,7 +274,9 @@
static int ap_process_http_connection(conn_rec *c)
{
request_rec *r;
-
+ int csd_set = 0;
+ apr_socket_t *csd = NULL;
+
/*
* Read and process each request found on our connection
* until no requests are left or we decide to close.
@@ -282,7 +284,7 @@
ap_update_child_status(c->sbh, SERVER_BUSY_READ, NULL);
while ((r = ap_read_request(c)) != NULL) {
-
+
c->keepalive = AP_CONN_UNKNOWN;
/* process the request if it was read without error */
@@ -301,6 +303,12 @@
if (ap_graceful_stop_signalled())
break;
+ /* Go straight to select() to wait for the next request */
+ if (!csd_set) {
+ csd = ap_get_module_config(c->conn_config, &core_module);
+ csd_set = 1;
+ }
+ apr_setsocketopt(csd, APR_INCOMPLETE_READ, 1);
}
return OK;