You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by mb...@apache.org on 2012/08/04 10:06:20 UTC

svn commit: r1369283 - /hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java

Author: mbautin
Date: Sat Aug  4 08:06:19 2012
New Revision: 1369283

URL: http://svn.apache.org/viewvc?rev=1369283&view=rev
Log:
[HBASE-6494] [0.89-fb] First steps towards adding a delete benchmark to loadtest

Author: aaiyer

Summary:
Adding a deletes test to the Performance Evaluation for testing the
performance gains from the delete locking changes and multiput/get/delete
integration.

Test Plan:
to be deployed to the dev server and test the performance of
HBase with and without the delete locking changes

Reviewers: kranganathan, liyintang

Reviewed By: kranganathan

CC: nzhang

Differential Revision: https://phabricator.fb.com/D514654

Modified:
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java?rev=1369283&r1=1369282&r2=1369283&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java (original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java Sat Aug  4 08:06:19 2012
@@ -43,6 +43,7 @@ import org.apache.hadoop.fs.FSDataInputS
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.client.Delete;
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HTable;
@@ -165,6 +166,10 @@ public class PerformanceEvaluation {
         "Run random seek scan with both start and stop row (max 10000 rows)");
     addCommandDescriptor(RandomWriteTest.class, "randomWrite",
         "Run random write test");
+    addCommandDescriptor(RandomDeleteTest.class, "randomDelete",
+        "Run random delete test");
+    addCommandDescriptor(RandomBatchedDeleteTest.class, "randomDeleteBatched",
+        "Run random delete (batched) test");
     addCommandDescriptor(SequentialReadTest.class, "sequentialRead",
         "Run sequential read test");
     addCommandDescriptor(SequentialWriteTest.class, "sequentialWrite",
@@ -927,6 +932,51 @@ public class PerformanceEvaluation {
 
   }
 
+  static class RandomDeleteTest extends Test {
+    RandomDeleteTest(Configuration conf, TestOptions options, Status status) {
+      super(conf, options, status);
+    }
+
+    @Override
+    void testRow(final int i) throws IOException {
+      byte [] row = getRandomRow(this.rand, this.totalRows);
+      long ts = this.rand.nextLong();
+      Delete delete = new Delete(row);
+      delete.deleteColumn(FAMILY_NAME, QUALIFIER_NAME, ts);
+      delete.setWriteToWAL(writeToWAL);
+      table.delete(delete);
+    }
+  }
+
+  static class RandomBatchedDeleteTest extends Test {
+    List<Delete> deletes;
+    static int BATCH_SIZE = 1000;
+    RandomBatchedDeleteTest(Configuration conf, TestOptions options, Status status) {
+      super(conf, options, status);
+      deletes = new ArrayList<Delete>();
+    }
+
+    @Override
+    void testRow(final int i) throws IOException {
+      byte [] row = getRandomRow(this.rand, this.totalRows);
+      long ts = this.rand.nextLong();
+      Delete delete = new Delete(row);
+      delete.deleteColumn(FAMILY_NAME, QUALIFIER_NAME, ts);
+      delete.setWriteToWAL(writeToWAL);
+      deletes.add(delete);
+
+      if (deletes.size() % BATCH_SIZE == 0)
+        table.delete(deletes);
+    }
+
+    @Override
+    void testTakedown() throws IOException {
+      if (deletes.size() != 0)
+        table.delete(deletes);
+      super.testTakedown();
+    }
+  }
+
   static class RandomWriteTest extends Test {
     RandomWriteTest(Configuration conf, TestOptions options, Status status) {
       super(conf, options, status);
@@ -943,6 +993,28 @@ public class PerformanceEvaluation {
     }
   }
 
+  static class RandomBatchedWriteTest extends Test {
+    List<Put> puts;
+    static int BATCH_SIZE = 1000;
+    RandomBatchedWriteTest(Configuration conf, TestOptions options, Status status) {
+      super(conf, options, status);
+      puts = new ArrayList<Put>();
+    }
+
+    @Override
+    void testRow(final int i) throws IOException {
+      byte [] row = getRandomRow(this.rand, this.totalRows);
+      Put put = new Put(row);
+      byte[] value = generateValue(this.rand);
+      put.add(FAMILY_NAME, QUALIFIER_NAME, value);
+      put.setWriteToWAL(writeToWAL);
+      puts.add(put);
+
+      if (puts.size() % BATCH_SIZE == 0)
+        table.put(puts);
+    }
+  }
+
   static class ScanTest extends Test {
     private ResultScanner testScanner;