You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by ri...@apache.org on 2022/08/19 21:12:48 UTC

[ozone] branch master updated: Multiple RPC clients per test run. (#3696)

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

ritesh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 4fd698f05e Multiple RPC clients per test run. (#3696)
4fd698f05e is described below

commit 4fd698f05e634a83db365a73d66fccbaa7e86198
Author: Duong Nguyen <du...@gmail.com>
AuthorDate: Fri Aug 19 14:12:43 2022 -0700

    Multiple RPC clients per test run. (#3696)
---
 .../hadoop/ozone/freon/OmRPCLoadGenerator.java     | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmRPCLoadGenerator.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmRPCLoadGenerator.java
index bfbb46c63e..5063a506dd 100644
--- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmRPCLoadGenerator.java
+++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmRPCLoadGenerator.java
@@ -46,7 +46,7 @@ public class OmRPCLoadGenerator extends BaseFreonGenerator
   private static final int MAX_SIZE_KB = 2097151;
   private Timer timer;
   private OzoneConfiguration configuration;
-  private OzoneManagerProtocolClientSideTranslatorPB client;
+  private OzoneManagerProtocolClientSideTranslatorPB[] clients;
   private byte[] payloadReqBytes = new byte[0];
   private int payloadRespSize;
   @Option(names = {"--payload-req"},
@@ -56,6 +56,12 @@ public class OmRPCLoadGenerator extends BaseFreonGenerator
           defaultValue = "0")
   private int payloadReqSizeKB = 0;
 
+  @Option(names = {"--clients"},
+      description =
+          "Number of clients, defaults 1.",
+      defaultValue = "1")
+  private int clientsCount = 1;
+
   @Option(names = {"--payload-resp"},
           description =
                   "Specifies the size of payload in KB in RPC response. " +
@@ -70,7 +76,11 @@ public class OmRPCLoadGenerator extends BaseFreonGenerator
             "OM echo response payload size should be positive value or zero.");
 
     configuration = createOzoneConfiguration();
-    client = createOmClient(configuration, null);
+    clients = new OzoneManagerProtocolClientSideTranslatorPB[clientsCount];
+    for (int i = 0; i < clientsCount; i++) {
+      clients[i] = createOmClient(configuration, null);
+    }
+
     init();
     payloadReqBytes = RandomUtils.nextBytes(
             calculateMaxPayloadSize(payloadReqSizeKB));
@@ -79,8 +89,10 @@ public class OmRPCLoadGenerator extends BaseFreonGenerator
     try {
       runTests(this::sendRPCReq);
     } finally {
-      if (client != null) {
-        client.close();
+      for (int i = 0; i < clientsCount; i++) {
+        if (clients[i] != null) {
+          clients[i].close();
+        }
       }
     }
     return null;
@@ -98,7 +110,7 @@ public class OmRPCLoadGenerator extends BaseFreonGenerator
 
   private void sendRPCReq(long l) throws Exception {
     timer.time(() -> {
-      client.echoRPCReq(payloadReqBytes,
+      clients[(int) (l % clientsCount)].echoRPCReq(payloadReqBytes,
               payloadRespSize);
       return null;
     });


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ozone.apache.org
For additional commands, e-mail: commits-help@ozone.apache.org