You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by pe...@apache.org on 2021/11/26 13:10:15 UTC

[pulsar] 04/14: [pulsar-perf]Support listenerThreads configuration. (#12892)

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

penghui pushed a commit to branch branch-2.8
in repository https://gitbox.apache.org/repos/asf/pulsar.git

commit dfd96072cf901d9dfb845daa72f200d594275616
Author: mingyifei <38...@users.noreply.github.com>
AuthorDate: Sat Nov 20 03:47:47 2021 +0800

    [pulsar-perf]Support listenerThreads configuration. (#12892)
    
    * Support listenerThreads configuration.
    
    * Support listenerThreads configuration.
    
    * Modified to short option.
    
    * Add listenerThreads configuration document.
    
    Co-authored-by: mingyifei <mi...@accesscorporate.com.cn>
    (cherry picked from commit ec715f280d20910fbeefe9e2bdd436799173a008)
---
 .../main/java/org/apache/pulsar/testclient/PerformanceConsumer.java  | 5 +++++
 .../main/java/org/apache/pulsar/testclient/PerformanceReader.java    | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java
index 59ffac3..e0fa99b 100644
--- a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java
+++ b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java
@@ -173,6 +173,10 @@ public class PerformanceConsumer {
                 "used for handling connections to brokers, default is 1 thread")
         public int ioThreads = 1;
 
+        @Parameter(names = {"-lt", "--num-listener-threads"}, description = "Set the number of threads"
+                + " to be used for message listeners")
+        public int listenerThreads = 1;
+
         @Parameter(names = {"--batch-index-ack" }, description = "Enable or disable the batch index acknowledgment")
         public boolean batchIndexAck = false;
 
@@ -323,6 +327,7 @@ public class PerformanceConsumer {
                 .connectionsPerBroker(arguments.maxConnections) //
                 .statsInterval(arguments.statsIntervalSeconds, TimeUnit.SECONDS) //
                 .ioThreads(arguments.ioThreads) //
+                .listenerThreads(arguments.listenerThreads)
                 .enableBusyWait(arguments.enableBusyWait)
                 .tlsTrustCertsFilePath(arguments.tlsTrustCertsFilePath);
         if (isNotBlank(arguments.authPluginClassName)) {
diff --git a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceReader.java b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceReader.java
index 778d51d..2748e6e 100644
--- a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceReader.java
+++ b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceReader.java
@@ -130,6 +130,10 @@ public class PerformanceReader {
         @Parameter(names = {"-ioThreads", "--num-io-threads"}, description = "Set the number of threads to be " +
                 "used for handling connections to brokers, default is 1 thread")
         public int ioThreads = 1;
+
+        @Parameter(names = {"-lt", "--num-listener-threads"}, description = "Set the number of threads"
+                + " to be used for message listeners")
+        public int listenerThreads = 1;
     }
 
     public static void main(String[] args) throws Exception {
@@ -243,6 +247,7 @@ public class PerformanceReader {
                 .connectionsPerBroker(arguments.maxConnections) //
                 .statsInterval(arguments.statsIntervalSeconds, TimeUnit.SECONDS) //
                 .ioThreads(arguments.ioThreads) //
+                .listenerThreads(arguments.listenerThreads)
                 .enableTls(arguments.useTls) //
                 .tlsTrustCertsFilePath(arguments.tlsTrustCertsFilePath);