This is an automated email from the ASF dual-hosted git repository. sanjeevrk 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 9dc3df6 Adjust the serving threads to have a minimum of threads (#3698) 9dc3df6 is described below commit 9dc3df6139ca7d2dbee4bef4c4450416b5c5279d Author: Sanjeev Kulkarni <sanjee...@gmail.com> AuthorDate: Mon Mar 4 15:46:20 2019 -0800 Adjust the serving threads to have a minimum of threads (#3698) --- conf/broker.conf | 2 +- conf/proxy.conf | 2 +- conf/standalone.conf | 3 +++ .../src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java | 2 +- .../main/java/org/apache/pulsar/proxy/server/ProxyConfiguration.java | 2 +- .../apache/pulsar/websocket/service/WebSocketProxyConfiguration.java | 2 +- 6 files changed, 8 insertions(+), 5 deletions(-) diff --git a/conf/broker.conf b/conf/broker.conf index 262c44c..73e94cd 100644 --- a/conf/broker.conf +++ b/conf/broker.conf @@ -46,7 +46,7 @@ advertisedAddress= # Number of threads to use for Netty IO. Default is set to 2 * Runtime.getRuntime().availableProcessors() numIOThreads= -# Number of threads to use for HTTP requests processing. Default is set to Runtime.getRuntime().availableProcessors() +# Number of threads to use for HTTP requests processing. Default is set to 2 * Runtime.getRuntime().availableProcessors() numHttpServerThreads= # Flag to control features that are meant to be used when running in standalone mode diff --git a/conf/proxy.conf b/conf/proxy.conf index 4d1904f..7e1a553 100644 --- a/conf/proxy.conf +++ b/conf/proxy.conf @@ -164,7 +164,7 @@ httpReverseProxyConfigs= httpOutputBufferSize=32768 # Number of threads to use for HTTP requests processing. Default is -# Runtime.getRuntime().availableProcessors() +# 2 * Runtime.getRuntime().availableProcessors() httpNumThreads= ### --- Token Authentication Provider --- ### diff --git a/conf/standalone.conf b/conf/standalone.conf index a8e7181..2c401b7 100644 --- a/conf/standalone.conf +++ b/conf/standalone.conf @@ -39,6 +39,9 @@ advertisedAddress= # Number of threads to use for Netty IO. Default is set to 2 * Runtime.getRuntime().availableProcessors() numIOThreads= +# Number of threads to use for HTTP requests processing. Default is set to 2 * Runtime.getRuntime().availableProcessors() +numHttpServerThreads= + # Name of the cluster to which this broker belongs to clusterName=standalone 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 cb36df4..a1f031d 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,7 @@ 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 = 2 * Runtime.getRuntime().availableProcessors(); + private int numHttpServerThreads = Math.max(4, 2 * Runtime.getRuntime().availableProcessors()); @FieldContext( category = CATEGORY_WEBSOCKET, diff --git a/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConfiguration.java b/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConfiguration.java index ae54d6e..37be744 100644 --- a/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConfiguration.java +++ b/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConfiguration.java @@ -305,7 +305,7 @@ public class ProxyConfiguration implements PulsarConfiguration { category = CATEGORY_HTTP, doc = "Number of threads to use for HTTP requests processing" ) - private int httpNumThreads = 2 * Runtime.getRuntime().availableProcessors(); + private int httpNumThreads = Math.max(4, 2 * Runtime.getRuntime().availableProcessors()); @PropertiesContext( properties = { diff --git a/pulsar-websocket/src/main/java/org/apache/pulsar/websocket/service/WebSocketProxyConfiguration.java b/pulsar-websocket/src/main/java/org/apache/pulsar/websocket/service/WebSocketProxyConfiguration.java index 72dd160..8b212d8 100644 --- a/pulsar-websocket/src/main/java/org/apache/pulsar/websocket/service/WebSocketProxyConfiguration.java +++ b/pulsar-websocket/src/main/java/org/apache/pulsar/websocket/service/WebSocketProxyConfiguration.java @@ -93,7 +93,7 @@ public class WebSocketProxyConfiguration implements PulsarConfiguration { private int webSocketNumIoThreads = Runtime.getRuntime().availableProcessors(); // Number of threads to use in HTTP server - private int numHttpServerThreads = Runtime.getRuntime().availableProcessors(); + private int numHttpServerThreads = Math.max(4, Runtime.getRuntime().availableProcessors()); // Number of connections per Broker in Pulsar Client used in WebSocket proxy private int webSocketConnectionsPerBroker = Runtime.getRuntime().availableProcessors();