Skip to content

Commit

Permalink
[pulsar-perf]Support listenerThreads configuration. (apache#12892)
Browse files Browse the repository at this point in the history
* Support listenerThreads configuration.

* Support listenerThreads configuration.

* Modified to short option.

* Add listenerThreads configuration document.

Co-authored-by: mingyifei <[email protected]>
  • Loading branch information
GhostBoyBoy and mingyifei authored Nov 19, 2021
1 parent dbac121 commit ec715f2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);

Expand Down
2 changes: 2 additions & 0 deletions site2/docs/reference-cli-tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down Expand Up @@ -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|
Expand Down
2 changes: 2 additions & 0 deletions site2/website-next/docs/reference-cli-tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down Expand Up @@ -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|
Expand Down

0 comments on commit ec715f2

Please sign in to comment.