You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2019/01/29 04:42:36 UTC

[pulsar] branch master updated: Keep function-worker web-server thread configurable (#3464)

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

mmerli 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 7e1c804  Keep function-worker web-server thread configurable (#3464)
7e1c804 is described below

commit 7e1c8047d0f9f1e2f170b9c88084369a7056828e
Author: Rajan Dhabalia <rd...@apache.org>
AuthorDate: Mon Jan 28 20:42:31 2019 -0800

    Keep function-worker web-server thread configurable (#3464)
---
 conf/functions_worker.yml                                            | 2 ++
 .../main/java/org/apache/pulsar/functions/worker/WorkerConfig.java   | 5 +++++
 .../java/org/apache/pulsar/functions/worker/rest/WorkerServer.java   | 2 +-
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/conf/functions_worker.yml b/conf/functions_worker.yml
index 185cc15..bdb5d67 100644
--- a/conf/functions_worker.yml
+++ b/conf/functions_worker.yml
@@ -53,6 +53,8 @@ pulsarFunctionsNamespace: public/functions
 pulsarFunctionsCluster: standalone
 functionMetadataTopicName: metadata
 clusterCoordinationTopicName: coordinate
+# Number of threads to use for HTTP requests processing. Default is set to 8
+numHttpServerThreads: 8
 
 # function assignment and scheduler
 
diff --git a/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/WorkerConfig.java b/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/WorkerConfig.java
index d37d93a..df9d872 100644
--- a/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/WorkerConfig.java
+++ b/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/WorkerConfig.java
@@ -95,6 +95,11 @@ public class WorkerConfig implements Serializable, PulsarConfiguration {
     )
     private Integer workerPortTls;
     @FieldContext(
+            category = CATEGORY_WORKER,
+            doc = "Number of threads to use for HTTP requests processing"
+        )
+    private int numHttpServerThreads = 8;
+    @FieldContext(
         category = CATEGORY_CONNECTORS,
         doc = "The path to the location to locate builtin connectors"
     )
diff --git a/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/WorkerServer.java b/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/WorkerServer.java
index 35a4b7a..44cffbc 100644
--- a/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/WorkerServer.java
+++ b/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/WorkerServer.java
@@ -76,7 +76,7 @@ public class WorkerServer {
     public WorkerServer(WorkerService workerService) {
         this.workerConfig = workerService.getWorkerConfig();
         this.workerService = workerService;
-        this.webServerExecutor = new WebExecutorThreadPool(8, "function-web");
+        this.webServerExecutor = new WebExecutorThreadPool(this.workerConfig.getNumHttpServerThreads(), "function-web");
         init();
     }