]> granicus.if.org Git - apache/commitdiff
Fix a bug in our output filter buffering. If a lot of small brigades are
authorRyan Bloom <rbb@apache.org>
Wed, 21 Nov 2001 18:25:40 +0000 (18:25 +0000)
committerRyan Bloom <rbb@apache.org>
Wed, 21 Nov 2001 18:25:40 +0000 (18:25 +0000)
sent, the core will send the first 16 buckets, regardless of how much
data there is.  In the pathological case, this can cause a lot of 16
byte packets.  Now, if we see less than AP_MIN_BYTES, we combine
all of the buckets into a single bucket to be sent in a later packet.

This can cause a lot of memory copies, but it eases our network traffic.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92097 13f79535-47bb-0310-9956-ffa450edef68

modules/generators/config5.m4
server/core.c

index 7113018226e51057d30d6164f03c604283fc1491..84eea049f38546cbc74d6a293d9dbf5736974648 100644 (file)
@@ -8,6 +8,7 @@ APACHE_MODULE(status, process/thread monitoring, , , yes)
 APACHE_MODULE(autoindex, directory listing, , , yes)
 APACHE_MODULE(asis, as-is filetypes, , , yes)
 APACHE_MODULE(info, server information, , , most)
+APACHE_MODULE(test_pass_brigade, TEST, , , most)
 APACHE_MODULE(suexec, set uid and gid for spawned processes, , , no, [
               other_targets=suexec ] )
 
index 779001a79a5ddb4403d306ea532a53c1197cf8f7..1296fea71da3fe8198022fc6db536d5ab428462e 100644 (file)
@@ -3079,9 +3079,26 @@ static apr_status_t core_output_filter(ap_filter_t *f, apr_bucket_brigade *b)
                 if (n) {
                     if (!fd) {
                         if (nvec == MAX_IOVEC_TO_WRITE) {
-                            /* woah! too many. stop now. */
-                            more = apr_brigade_split(b, e);
-                            break;
+                            /* woah! too many. buffer them up, for use later. */
+                            apr_bucket *temp;
+                            apr_bucket_brigade *temp_brig;
+
+                            temp_brig = apr_brigade_create(f->c->pool);
+                            temp = APR_BRIGADE_FIRST(b);
+                            while (temp != e) {
+                                apr_bucket *d;
+                                rv = apr_bucket_read(e, &str, &n, APR_BLOCK_READ);
+                                apr_brigade_write(temp_brig, NULL, NULL, str, n);
+                                d = temp;
+                                temp = APR_BUCKET_NEXT(temp);
+                                apr_bucket_delete(d);
+                            }
+                            temp = APR_BRIGADE_FIRST(temp_brig);
+                            APR_BUCKET_REMOVE(temp);
+                            APR_BRIGADE_INSERT_HEAD(b, temp);
+                            apr_brigade_destroy(temp_brig);
+                            e = temp;
+                            nvec = 0;
                         }
                         vec[nvec].iov_base = (char*) str;
                         vec[nvec].iov_len = n;