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

penghui 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 b69bce74248 [improve][tool] Able to set maxLookupRequest for 
pulsar-perf (#16967)
b69bce74248 is described below

commit b69bce74248bc003506e4729f54d5ec4db22c86d
Author: Penghui Li <[email protected]>
AuthorDate: Mon Aug 8 11:12:03 2022 +0800

    [improve][tool] Able to set maxLookupRequest for pulsar-perf (#16967)
---
 .../src/main/java/org/apache/pulsar/testclient/PerfClientUtils.java   | 3 ++-
 .../java/org/apache/pulsar/testclient/PerformanceBaseArguments.java   | 4 ++++
 .../test/java/org/apache/pulsar/testclient/PerfClientUtilsTest.java   | 2 ++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git 
a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerfClientUtils.java
 
b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerfClientUtils.java
index 2b0c989bfbb..1ce5777fd32 100644
--- 
a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerfClientUtils.java
+++ 
b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerfClientUtils.java
@@ -74,7 +74,8 @@ public class PerfClientUtils {
                 .statsInterval(arguments.statsIntervalSeconds, 
TimeUnit.SECONDS)
                 .enableBusyWait(arguments.enableBusyWait)
                 .listenerThreads(arguments.listenerThreads)
-                .tlsTrustCertsFilePath(arguments.tlsTrustCertsFilePath);
+                .tlsTrustCertsFilePath(arguments.tlsTrustCertsFilePath)
+                .maxLookupRequests(arguments.maxLookupRequest);
 
         if (isNotBlank(arguments.authPluginClassName)) {
             clientBuilder.authentication(arguments.authPluginClassName, 
arguments.authParams);
diff --git 
a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceBaseArguments.java
 
b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceBaseArguments.java
index cb4f9137ac9..cff7e16e9ca 100644
--- 
a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceBaseArguments.java
+++ 
b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceBaseArguments.java
@@ -81,6 +81,10 @@ public abstract class PerformanceBaseArguments {
             + " to be used for message listeners")
     public int listenerThreads = 1;
 
+    @Parameter(names = {"-mlr", "--max-lookup-request"}, description = 
"Maximum number of lookup requests allowed "
+            + "on each broker connection to prevent overloading a broker")
+    public int maxLookupRequest = 50000;
+
     public abstract void fillArgumentsFromProperties(Properties prop);
 
     @SneakyThrows
diff --git 
a/pulsar-testclient/src/test/java/org/apache/pulsar/testclient/PerfClientUtilsTest.java
 
b/pulsar-testclient/src/test/java/org/apache/pulsar/testclient/PerfClientUtilsTest.java
index 78dbc1fff88..ea21112635a 100644
--- 
a/pulsar-testclient/src/test/java/org/apache/pulsar/testclient/PerfClientUtilsTest.java
+++ 
b/pulsar-testclient/src/test/java/org/apache/pulsar/testclient/PerfClientUtilsTest.java
@@ -70,6 +70,7 @@ public class PerfClientUtilsTest {
         args.serviceURL = "pulsar+ssl://my-pulsar:6651";
         args.tlsTrustCertsFilePath = "path";
         args.tlsAllowInsecureConnection = true;
+        args.maxLookupRequest = 100000;
 
         final ClientBuilderImpl builder = 
(ClientBuilderImpl)PerfClientUtils.createClientBuilderFromArguments(args);
         final ClientConfigurationData conf = 
builder.getClientConfigurationData();
@@ -86,6 +87,7 @@ public class PerfClientUtilsTest {
         Assert.assertEquals(conf.getServiceUrl(), 
"pulsar+ssl://my-pulsar:6651");
         Assert.assertEquals(conf.getTlsTrustCertsFilePath(), "path");
         Assert.assertTrue(conf.isTlsAllowInsecureConnection());
+        Assert.assertEquals(conf.getMaxLookupRequest(), 100000);
 
     }
 }
\ No newline at end of file

Reply via email to