You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by si...@apache.org on 2019/03/07 13:42:57 UTC

[pulsar] branch master updated: Use at least 8 threads in Jetty thread pool (#3776)

This is an automated email from the ASF dual-hosted git repository.

sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 7a9f7f3  Use at least 8 threads in Jetty thread pool (#3776)
7a9f7f3 is described below

commit 7a9f7f338ef7ca2d77a6fe5951afd1eacbd04207
Author: Matteo Merli <mm...@apache.org>
AuthorDate: Thu Mar 7 05:42:52 2019 -0800

    Use at least 8 threads in Jetty thread pool (#3776)
    
    ### Motivation
    
    Use at least 8 threads to avoid having Jetty go into threads starving and
    having the possibility of getting into a deadlock where a Jetty thread is
    waiting for another HTTP call to complete in same thread.
    
    This solve the issues of requests timing out when the broker is making REST
    calls to itself. Such examples are when running in standalone mode and
    creating a function.
---
 .../src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java b/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java
index a1f031d..39c3e42 100644
--- a/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java
+++ b/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java
@@ -146,7 +146,10 @@ public class ServiceConfiguration implements PulsarConfiguration {
             doc = "Number of threads to use for HTTP requests processing"
                 + " Default is set to `2 * Runtime.getRuntime().availableProcessors()`"
         )
-    private int numHttpServerThreads = Math.max(4, 2 * Runtime.getRuntime().availableProcessors());
+    // Use at least 8 threads to avoid having Jetty go into threads starving and
+    // having the possibility of getting into a deadlock where a Jetty thread is
+    // waiting for another HTTP call to complete in same thread.
+    private int numHttpServerThreads = Math.max(8, 2 * Runtime.getRuntime().availableProcessors());
 
     @FieldContext(
         category = CATEGORY_WEBSOCKET,