helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ka...@apache.org
Subject [1/2] git commit: Adds -maxChannelLifeMillis CLI argument to BenchmarkDriver
Date Thu, 11 Sep 2014 03:37:49 GMT
Repository: helix
Updated Branches:
  refs/heads/master ef2fac3b9 -> e8cf54e09


Adds -maxChannelLifeMillis CLI argument to BenchmarkDriver


Project: http://git-wip-us.apache.org/repos/asf/helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/126849d5
Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/126849d5
Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/126849d5

Branch: refs/heads/master
Commit: 126849d53d52b4eeb1c94ad8cba7209c48d468c8
Parents: ef2fac3
Author: Greg Brandt <brandt.greg@gmail.com>
Authored: Wed Sep 10 11:37:00 2014 -0700
Committer: Greg Brandt <brandt.greg@gmail.com>
Committed: Wed Sep 10 11:37:00 2014 -0700

----------------------------------------------------------------------
 .../helix/ipc/benchmark/BenchmarkDriver.java    | 28 ++++++++++++++------
 1 file changed, 20 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/126849d5/helix-ipc/src/test/java/org/apache/helix/ipc/benchmark/BenchmarkDriver.java
----------------------------------------------------------------------
diff --git a/helix-ipc/src/test/java/org/apache/helix/ipc/benchmark/BenchmarkDriver.java b/helix-ipc/src/test/java/org/apache/helix/ipc/benchmark/BenchmarkDriver.java
index 2d682f7..13d9b3f 100644
--- a/helix-ipc/src/test/java/org/apache/helix/ipc/benchmark/BenchmarkDriver.java
+++ b/helix-ipc/src/test/java/org/apache/helix/ipc/benchmark/BenchmarkDriver.java
@@ -64,18 +64,24 @@ public class BenchmarkDriver implements Runnable {
   private final AtomicBoolean isShutdown;
   private final byte[] messageBytes;
   private final int numConnections;
+  private final long maxChannelLifeMillis;
 
   private HelixIPCService ipcService;
   private String localhost;
   private Thread[] trafficThreads;
 
-  public BenchmarkDriver(int port, int numPartitions, int numThreads, int messageSize,
-      int numConnections) {
+  public BenchmarkDriver(int port,
+                         int numPartitions,
+                         int numThreads,
+                         int messageSize,
+                         int numConnections,
+                         long maxChannelLifeMillis) {
     this.port = port;
     this.numPartitions = numPartitions;
     this.isShutdown = new AtomicBoolean(true);
     this.trafficThreads = new Thread[numThreads];
     this.numConnections = numConnections;
+    this.maxChannelLifeMillis = maxChannelLifeMillis;
 
     StringBuilder sb = new StringBuilder();
     for (int i = 0; i < messageSize; i++) {
@@ -105,8 +111,10 @@ public class BenchmarkDriver implements Runnable {
       localhost = InetAddress.getLocalHost().getCanonicalHostName();
       ipcService =
           new NettyHelixIPCService(new NettyHelixIPCService.Config()
-              .setInstanceName(localhost + "_" + port).setPort(port)
-              .setNumConnections(numConnections));
+              .setInstanceName(localhost + "_" + port)
+              .setPort(port)
+              .setNumConnections(numConnections)
+              .setMaxChannelLifeMillis(maxChannelLifeMillis));
 
       // Counts number of messages received, and ack them
       ipcService.registerCallback(MESSAGE_TYPE, new HelixIPCCallback() {
@@ -193,6 +201,7 @@ public class BenchmarkDriver implements Runnable {
     options.addOption("threads", true, "Number of threads");
     options.addOption("messageSize", true, "Message size in bytes");
     options.addOption("numConnections", true, "Number of connections between nodes");
+    options.addOption("maxChannelLifeMillis", true, "Maximum length of time to keep Netty
Channel open");
 
     CommandLine commandLine = new GnuParser().parse(options, args);
 
@@ -211,10 +220,13 @@ public class BenchmarkDriver implements Runnable {
       }
     });
 
-    new BenchmarkDriver(Integer.parseInt(commandLine.getArgs()[0]), Integer.parseInt(commandLine
-        .getOptionValue("partitions", "1")), Integer.parseInt(commandLine.getOptionValue("threads",
-        "1")), Integer.parseInt(commandLine.getOptionValue("messageSize", "1024")),
-        Integer.parseInt(commandLine.getOptionValue("numConnections", "1"))).run();
+    new BenchmarkDriver(
+            Integer.parseInt(commandLine.getArgs()[0]),
+            Integer.parseInt(commandLine.getOptionValue("partitions", "1")),
+            Integer.parseInt(commandLine.getOptionValue("threads", "1")),
+            Integer.parseInt(commandLine.getOptionValue("messageSize", "1024")),
+            Integer.parseInt(commandLine.getOptionValue("numConnections", "1")),
+            Long.parseLong(commandLine.getOptionValue("maxChannelLifeMillis", "5000"))).run();
 
     latch.await();
   }


Mime
View raw message