]> granicus.if.org Git - apache/commitdiff
reducing # of file handles used in transfers by default, reduced global workers lock...
authorStefan Eissing <icing@apache.org>
Tue, 5 Jan 2016 14:29:30 +0000 (14:29 +0000)
committerStefan Eissing <icing@apache.org>
Tue, 5 Jan 2016 14:29:30 +0000 (14:29 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1723084 13f79535-47bb-0310-9956-ffa450edef68

modules/http2/h2_conn.c
modules/http2/h2_mplx.c
modules/http2/h2_workers.c

index 0f99076a1c59942ad8d05e1ce686665facaea309..abc8d8989c16b24a510c8745b1956db56194c079 100644 (file)
@@ -117,7 +117,7 @@ apr_status_t h2_conn_child_init(apr_pool_t *pool, server_rec *s)
      */
     n = h2_config_geti(config, H2_CONF_SESSION_FILES);
     if (n < 0) {
-        max_tx_handles = 256;
+        max_tx_handles = maxw * 2;
     }
     else {
         max_tx_handles = maxw * n;
index 28c1d1015990c1d17933627e6c9224d4aa2203b8..f016a5aa80f648e0e83f3eb2ae37bf3c8c5f3cc6 100644 (file)
@@ -894,7 +894,6 @@ apr_status_t h2_mplx_reprioritize(h2_mplx *m, h2_stream_pri_cmp *cmp, void *ctx)
         }
         apr_thread_mutex_unlock(m->lock);
     }
-    workers_register(m);
     return status;
 }
 
@@ -921,6 +920,7 @@ apr_status_t h2_mplx_process(h2_mplx *m, int stream_id, const h2_request *req,
                              h2_stream_pri_cmp *cmp, void *ctx)
 {
     apr_status_t status;
+    int was_empty = 0;
     
     AP_DEBUG_ASSERT(m);
     status = apr_thread_mutex_lock(m->lock);
@@ -936,6 +936,7 @@ apr_status_t h2_mplx_process(h2_mplx *m, int stream_id, const h2_request *req,
                 status = h2_io_in_close(io);
             }
             
+            was_empty = h2_tq_empty(m->q);
             h2_tq_add(m->q, io->id, cmp, ctx);
             
             ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, m->c,
@@ -944,8 +945,7 @@ apr_status_t h2_mplx_process(h2_mplx *m, int stream_id, const h2_request *req,
         }
         apr_thread_mutex_unlock(m->lock);
     }
-    
-    if (status == APR_SUCCESS) {
+    if (status == APR_SUCCESS && was_empty) {
         workers_register(m);
     }
     return status;
index f0020c81ebb83d4bb8ce06bd76803bbb9d82012e..1b95cecbce6f54d25c5ec83e9a99149906ab8499 100644 (file)
@@ -322,6 +322,8 @@ apr_status_t h2_workers_register(h2_workers *workers, struct h2_mplx *m)
         ap_log_error(APLOG_MARK, APLOG_TRACE3, status, workers->s,
                      "h2_workers: register mplx(%ld)", m->id);
         if (in_list(workers, m)) {
+            ap_log_error(APLOG_MARK, APLOG_INFO, 0, workers->s,
+                         "h2_workers: already registered mplx(%ld)", m->id);
             status = APR_EAGAIN;
         }
         else {
@@ -332,16 +334,13 @@ apr_status_t h2_workers_register(h2_workers *workers, struct h2_mplx *m)
         if (workers->idle_worker_count > 0) { 
             apr_thread_cond_signal(workers->mplx_added);
         }
-        else if (workers->worker_count < workers->max_size) {
+        else if (status == APR_SUCCESS 
+                 && workers->worker_count < workers->max_size) {
             ap_log_error(APLOG_MARK, APLOG_TRACE3, 0, workers->s,
                          "h2_workers: got %d worker, adding 1", 
                          workers->worker_count);
             add_worker(workers);
         }
-        
-        /* cleanup any zombie workers that may have accumulated */
-        cleanup_zombies(workers, 0);
-        
         apr_thread_mutex_unlock(workers->lock);
     }
     return status;
@@ -356,9 +355,6 @@ apr_status_t h2_workers_unregister(h2_workers *workers, struct h2_mplx *m)
             H2_MPLX_REMOVE(m);
             status = APR_SUCCESS;
         }
-        /* cleanup any zombie workers that may have accumulated */
-        cleanup_zombies(workers, 0);
-        
         apr_thread_mutex_unlock(workers->lock);
     }
     return status;