You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2019/05/20 20:57:44 UTC

[GitHub] [accumulo-testing] keith-turner commented on a change in pull request #74: Add Durability Performance Test to Fix Durability IT

keith-turner commented on a change in pull request #74: Add Durability Performance Test to Fix Durability IT
URL: https://github.com/apache/accumulo-testing/pull/74#discussion_r285765158
 
 

 ##########
 File path: src/main/java/org/apache/accumulo/testing/performance/tests/DurabilityWriteSpeedPT.java
 ##########
 @@ -0,0 +1,110 @@
+package org.apache.accumulo.testing.performance.tests;
+
+import java.util.Arrays;
+
+import org.apache.accumulo.core.client.AccumuloClient;
+import org.apache.accumulo.core.client.BatchWriter;
+import org.apache.accumulo.core.client.admin.TableOperations;
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.core.data.Mutation;
+import org.apache.accumulo.testing.performance.Environment;
+import org.apache.accumulo.testing.performance.PerformanceTest;
+import org.apache.accumulo.testing.performance.Report;
+import org.apache.accumulo.testing.performance.SystemConfiguration;
+
+public class DurabilityWriteSpeedPT implements PerformanceTest {
+  static final long N = 100000;
+
+  @Override
+  public SystemConfiguration getSystemConfig() {
+    return new SystemConfiguration();
+  }
+
+  private String[] init(AccumuloClient c) throws Exception {
+    String[] tableNames = getUniqueNames(4);
+    TableOperations tableOps = c.tableOperations();
+    createTable(c, tableNames[0]);
+    createTable(c, tableNames[1]);
+    createTable(c, tableNames[2]);
+    createTable(c, tableNames[3]);
+    // default is sync
+    tableOps.setProperty(tableNames[1], Property.TABLE_DURABILITY.getKey(), "flush");
+    tableOps.setProperty(tableNames[2], Property.TABLE_DURABILITY.getKey(), "log");
+    tableOps.setProperty(tableNames[3], Property.TABLE_DURABILITY.getKey(), "none");
+    return tableNames;
+  }
+
+  private void createTable(AccumuloClient c, String tableName) throws Exception {
+    c.tableOperations().create(tableName);
+  }
+
+  @Override
+  public Report runTest(Environment env) throws Exception {
+    Report.Builder reportBuilder = Report.builder();
+    reportBuilder.id("durability");
+    reportBuilder.description("Compares writes speeds at different durability levels");
+    try (AccumuloClient client = env.getClient()) {
+      TableOperations tableOps = client.tableOperations();
+      String[] tableNames = init(client);
+      // write some gunk, delete the table to keep that table from messing with the performance
+      // numbers of successive calls
+      // sync
+      long t0 = writeSome(reportBuilder, client, tableNames[0], N, "Sync");
 
 Review comment:
   Looking at this, it seems like this test could be simplified with a loop... something like :
   
   ```java
     for(String durability : new String[]{"sync","flush","log","none"}){
        String tableName = durability+"T";
         createTable(c, tableName, durability);
         long median = writeSome(reportBuilder, client, tableName, N, durability);
         tableOps.delete(tableName);
         reportBuilder.result( durability+" Median", median, "Median time result for "+durability);
     }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services