]> granicus.if.org Git - apache/commitdiff
Readjusting how the bucket alloc is done for each worker thread. Allocate
authorBradley Nicholes <bnicholes@apache.org>
Tue, 30 Apr 2002 14:32:07 +0000 (14:32 +0000)
committerBradley Nicholes <bnicholes@apache.org>
Tue, 30 Apr 2002 14:32:07 +0000 (14:32 +0000)
the bucket once per thread rather than on every request.  This change
increases our performance significantly.

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

server/mpm/netware/mpm_netware.c

index f29e61af044e2c242302492e97fe6103487d1451..5cedfe0b83db86924fc986611c86ea0764e10ce2 100644 (file)
@@ -204,10 +204,9 @@ static int show_settings = 0;
 #endif
 
 /* a clean exit from a child with proper cleanup */
-static void clean_child_exit(int code, int worker_num, apr_bucket_alloc_t *bucket_alloc) __attribute__ ((noreturn));
-static void clean_child_exit(int code, int worker_num, apr_bucket_alloc_t *bucket_alloc)
+static void clean_child_exit(int code, int worker_num) __attribute__ ((noreturn));
+static void clean_child_exit(int code, int worker_num)
 {
-    apr_bucket_alloc_destroy(bucket_alloc);
     apr_thread_mutex_lock(worker_thread_count_mutex);
     worker_thread_count--;
     apr_thread_mutex_unlock(worker_thread_count_mutex);
@@ -353,6 +352,7 @@ void worker_main(void *arg)
     ap_listen_rec *lr;
     ap_listen_rec *last_lr = NULL;
     apr_pool_t *ptrans;
+    apr_pool_t *pbucket;
     apr_allocator_t *allocator;
     apr_bucket_alloc_t *bucket_alloc;
     conn_rec *current_conn;
@@ -375,9 +375,14 @@ void worker_main(void *arg)
     apr_allocator_create(&allocator);
     apr_pool_create_ex(&ptrans, NULL, NULL, allocator);
     apr_allocator_set_owner(allocator, ptrans);
-
     apr_pool_tag(ptrans, "transaction");
 
+    apr_allocator_create(&allocator);
+    apr_pool_create_ex(&pbucket, NULL, NULL, allocator);
+    apr_allocator_set_owner(allocator, pbucket);
+    apr_pool_tag(pbucket, "bucket_allocs");
+    bucket_alloc = apr_bucket_alloc_create(pbucket);
+
     apr_thread_mutex_lock(worker_thread_count_mutex);
     worker_thread_count++;
     apr_thread_mutex_unlock(worker_thread_count_mutex);
@@ -391,11 +396,10 @@ void worker_main(void *arg)
         */
         current_conn = NULL;
         apr_pool_clear(ptrans);
-        bucket_alloc = apr_bucket_alloc_create(ptrans);
 
         if ((ap_max_requests_per_child > 0
             && requests_this_child++ >= ap_max_requests_per_child)) {
-            clean_child_exit(0, my_worker_num, bucket_alloc);
+            clean_child_exit(0, my_worker_num);
         }
 
         ap_update_child_status_from_indexes(0, my_worker_num, WORKER_READY, 
@@ -412,7 +416,7 @@ void worker_main(void *arg)
             if (shutdown_pending || restart_pending || (ap_scoreboard_image->servers[0][my_worker_num].status == WORKER_IDLE_KILL)) {
                 DBPRINT1 ("\nThread slot %d is shutting down\n", my_worker_num);
                 apr_thread_mutex_unlock(accept_mutex);
-                clean_child_exit(0, my_worker_num, bucket_alloc);
+                clean_child_exit(0, my_worker_num);
             }
 
             /* If we just satisfied a request on listen port x, assume that more 
@@ -518,13 +522,13 @@ got_listener:
                         ap_log_error(APLOG_MARK, APLOG_EMERG, stat, ap_server_conf,
                             "apr_accept: giving up.");
                         apr_thread_mutex_unlock(accept_mutex);
-                        clean_child_exit(APEXIT_CHILDFATAL, my_worker_num, bucket_alloc);
+                        clean_child_exit(APEXIT_CHILDFATAL, my_worker_num);
 
                     default:
                         ap_log_error(APLOG_MARK, APLOG_ERR, stat, ap_server_conf,
                             "apr_accept: (client socket)");
                         apr_thread_mutex_unlock(accept_mutex);
-                        clean_child_exit(1, my_worker_num, bucket_alloc);
+                        clean_child_exit(1, my_worker_num);
                 }
             }
         }
@@ -546,7 +550,7 @@ got_listener:
         }
         request_count++;
     }
-    clean_child_exit(0, my_worker_num, bucket_alloc);
+    clean_child_exit(0, my_worker_num);
 }