You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by nd...@apache.org on 2014/04/26 07:35:24 UTC

svn commit: r1590216 - /hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java

Author: ndimiduk
Date: Sat Apr 26 05:35:24 2014
New Revision: 1590216

URL: http://svn.apache.org/r1590216
Log:
HBASE-9953 PerformanceEvaluation: Decouple data size from client concurrency

Modified:
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java?rev=1590216&r1=1590215&r2=1590216&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java Sat Apr 26 05:35:24 2014
@@ -119,6 +119,7 @@ public class PerformanceEvaluation exten
   private static final MathContext CXT = MathContext.DECIMAL64;
   private static final BigDecimal MS_PER_SEC = BigDecimal.valueOf(1000);
   private static final BigDecimal BYTES_PER_MB = BigDecimal.valueOf(1024 * 1024);
+  private static final TestOptions DEFAULT_OPTS = new TestOptions();
 
   protected Map<String, CmdDescriptor> commands = new TreeMap<String, CmdDescriptor>();
 
@@ -484,6 +485,7 @@ public class PerformanceEvaluation exten
     public TestOptions(TestOptions that) {
       this.nomapred = that.nomapred;
       this.startRow = that.startRow;
+      this.size = that.size;
       this.perClientRunRows = that.perClientRunRows;
       this.numClientThreads = that.numClientThreads;
       this.totalRows = that.totalRows;
@@ -507,6 +509,7 @@ public class PerformanceEvaluation exten
     public boolean nomapred = false;
     public boolean filterAll = false;
     public int startRow = 0;
+    public float size = 1.0f;
     public int perClientRunRows = ROWS_PER_GB;
     public int numClientThreads = 1;
     public int totalRows = ROWS_PER_GB;
@@ -1106,6 +1109,8 @@ public class PerformanceEvaluation exten
     System.err.println(" nomapred        Run multiple clients using threads " +
       "(rather than use mapreduce)");
     System.err.println(" rows            Rows each client runs. Default: One million");
+    System.err.println(" size            Total size in GiB. Mutually exclusive with --rows. " +
+      "Default: 1.0.");
     System.err.println(" modulo          Modulo we use dividing random. Default: Clients x rows");
     System.err.println(" sampleRate      Execute test on a sample of total " +
       "rows. Only supported by randomRead. Default: 1.0");
@@ -1288,12 +1293,29 @@ public class PerformanceEvaluation exten
           continue;
         }
 
+        final String size = "--size=";
+        if (cmd.startsWith(size)) {
+          opts.size = Float.parseFloat(cmd.substring(size.length()));
+          continue;
+        }
+
         Class<? extends Test> cmdClass = determineCommandClass(cmd);
         if (cmdClass != null) {
           opts.numClientThreads = getNumClients(i + 1, args);
-          // number of rows specified
-          opts.totalRows = opts.perClientRunRows * opts.numClientThreads;
-          if (opts.modulo == -1) opts.modulo = opts.totalRows;
+          if (opts.size != DEFAULT_OPTS.size &&
+            opts.perClientRunRows != DEFAULT_OPTS.perClientRunRows) {
+            throw new IllegalArgumentException(rows + " and " + size + " are mutually exclusive arguments.");
+          }
+          if (opts.size != DEFAULT_OPTS.size) {
+            // total size in GB specified
+            opts.totalRows = (int) opts.size * ROWS_PER_GB;
+            opts.perClientRunRows = opts.totalRows / opts.numClientThreads;
+          } else if (opts.perClientRunRows != DEFAULT_OPTS.perClientRunRows) {
+            // number of rows specified
+            opts.totalRows = opts.perClientRunRows * opts.numClientThreads;
+            opts.size = opts.totalRows / ROWS_PER_GB;
+          }
+          if (opts.modulo == DEFAULT_OPTS.modulo) opts.modulo = opts.totalRows;
           runTest(cmdClass, opts);
           errCode = 0;
           break;