From ec715f280d20910fbeefe9e2bdd436799173a008 Mon Sep 17 00:00:00 2001 From: mingyifei <38995810+mingyifei@users.noreply.github.com> Date: Sat, 20 Nov 2021 03:47:47 +0800 Subject: [PATCH] [pulsar-perf]Support listenerThreads configuration. (#12892) * Support listenerThreads configuration. * Support listenerThreads configuration. * Modified to short option. * Add listenerThreads configuration document. Co-authored-by: mingyifei --- .../org/apache/pulsar/testclient/PerformanceConsumer.java | 5 +++++ .../java/org/apache/pulsar/testclient/PerformanceReader.java | 5 +++++ site2/docs/reference-cli-tools.md | 2 ++ site2/website-next/docs/reference-cli-tools.md | 2 ++ 4 files changed, 14 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 51e2185a8ebce..9b2201eb000b8 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 @@ -180,6 +180,10 @@ static class Arguments { "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; @@ -340,6 +344,7 @@ public static void main(String[] args) throws Exception { .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 a7f66ad36a3b4..44e555560cc13 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 @@ -134,6 +134,10 @@ static class Arguments { @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 { @@ -252,6 +256,7 @@ public static void main(String[] args) throws Exception { .connectionsPerBroker(arguments.maxConnections) // .statsInterval(arguments.statsIntervalSeconds, TimeUnit.SECONDS) // .ioThreads(arguments.ioThreads) // + .listenerThreads(arguments.listenerThreads) .enableTls(arguments.useTls) // .tlsTrustCertsFilePath(arguments.tlsTrustCertsFilePath); diff --git a/site2/docs/reference-cli-tools.md b/site2/docs/reference-cli-tools.md index 45105c82d3b15..40db0d856c320 100644 --- a/site2/docs/reference-cli-tools.md +++ b/site2/docs/reference-cli-tools.md @@ -452,6 +452,7 @@ Options |`-mc`, `--max_chunked_msg`|Max pending chunk messages|0| |`-n`, `--num-consumers`|Number of consumers (per topic)|1| |`-ioThreads`, `--num-io-threads`|Set the number of threads to be used for handling connections to brokers|1| +|`-lt`, `--num-listener-threads`|Set the number of threads to be used for message listeners|1| |`-ns`, `--num-subscriptions`|Number of subscriptions (per topic)|1| |`-t`, `--num-topics`|The number of topics|1| |`-pm`, `--pool-messages`|Use the pooled message|true| @@ -546,6 +547,7 @@ Options |`-n`, `--num-messages`|Number of messages to consume in total. If the value is equal to or smaller than 0, it keeps consuming messages.|0| |`-c`, `--max-connections`|Max number of TCP connections to a single broker|100| |`-ioThreads`, `--num-io-threads`|Set the number of threads to be used for handling connections to brokers|1| +|`-lt`, `--num-listener-threads`|Set the number of threads to be used for message listeners|1| |`-t`, `--num-topics`|The number of topics|1| |`-r`, `--rate`|Simulate a slow message reader (rate in msg/s)|0| |`-q`, `--receiver-queue-size`|Size of the receiver queue|1000| diff --git a/site2/website-next/docs/reference-cli-tools.md b/site2/website-next/docs/reference-cli-tools.md index 3bafe1b66d19d..7f38306e14fad 100644 --- a/site2/website-next/docs/reference-cli-tools.md +++ b/site2/website-next/docs/reference-cli-tools.md @@ -545,6 +545,7 @@ Options |`-mc`, `--max_chunked_msg`|Max pending chunk messages|0| |`-n`, `--num-consumers`|Number of consumers (per topic)|1| |`-ioThreads`, `--num-io-threads`|Set the number of threads to be used for handling connections to brokers|1| +|`-lt`, `--num-listener-threads`|Set the number of threads to be used for message listeners|1| |`-ns`, `--num-subscriptions`|Number of subscriptions (per topic)|1| |`-t`, `--num-topics`|The number of topics|1| |`-pm`, `--pool-messages`|Use the pooled message|true| @@ -645,6 +646,7 @@ Options |`-n`, `--num-messages`|Number of messages to consume in total. If the value is equal to or smaller than 0, it keeps consuming messages.|0| |`-c`, `--max-connections`|Max number of TCP connections to a single broker|100| |`-ioThreads`, `--num-io-threads`|Set the number of threads to be used for handling connections to brokers|1| +|`-lt`, `--num-listener-threads`|Set the number of threads to be used for message listeners|1| |`-t`, `--num-topics`|The number of topics|1| |`-r`, `--rate`|Simulate a slow message reader (rate in msg/s)|0| |`-q`, `--receiver-queue-size`|Size of the receiver queue|1000|