elinaawise commented on a change in pull request #75: Fix #67: Test group commit performance URL: https://github.com/apache/accumulo-testing/pull/75#discussion_r291342236
########## File path: src/main/java/org/apache/accumulo/testing/performance/tests/GroupCommitPT.java ########## @@ -0,0 +1,243 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.accumulo.testing.performance.tests; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.Random; + +import org.apache.accumulo.core.client.BatchWriter; +import org.apache.accumulo.core.client.BatchWriterConfig; +import org.apache.accumulo.core.client.MutationsRejectedException; +import org.apache.accumulo.core.client.Scanner; +import org.apache.accumulo.core.client.TableExistsException; +import org.apache.accumulo.core.conf.Property; +import org.apache.accumulo.core.data.Key; +import org.apache.accumulo.core.data.Mutation; +import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.security.Authorizations; +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 GroupCommitPT implements PerformanceTest { + + static Mutation createRandomMutation(Random rand) { + byte row[] = new byte[16]; + + rand.nextBytes(row); + + Mutation m = new Mutation(row); + + byte cq[] = new byte[8]; + byte val[] = new byte[16]; + + for (int i = 0; i < 3; i++) { + rand.nextBytes(cq); + rand.nextBytes(val); + m.put("cf".getBytes(), cq, val); + } + + return m; + } + + static class WriteTask implements Runnable { + + private int numToWrite; + private int numToBatch; + private BatchWriter bw; + private volatile long time = -1; + + WriteTask(BatchWriter bw, int numToWrite, int numToBatch) throws Exception { + this.bw = bw; + this.numToWrite = numToWrite; + this.numToBatch = numToBatch; + } + + @Override + public void run() { + Random rand = new Random(); + + try { + long t1 = System.currentTimeMillis(); + for (int i = 0; i < numToWrite; i++) { + Mutation mut = createRandomMutation(rand); + + for (int j = 0; j < numToBatch; j++) { + bw.addMutation(mut); + } + + bw.flush(); + } + + // bw.flush(); + + long t2 = System.currentTimeMillis(); + this.time = t2 - t1; + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + bw.close(); + } catch (MutationsRejectedException e) { + e.printStackTrace(); + } + + } + } + + long getTime() { + return time; + } + } + + @Override + public SystemConfiguration getSystemConfig() { + + Map<String,String> siteCfg = new HashMap<>(); + + siteCfg.put(Property.TSERV_MINTHREADS.getKey(), "128"); + siteCfg.put(Property.TABLE_DURABILITY.getKey(), "log"); Review comment: I was following your mutslam code in which the Generator.java class had TABLE_WALOG_ENABLED set in runTest(...). The TABLE_WALOG_ENABLED has been replaced by TABLE_DURABILITY, which default is "sync". ---------------------------------------------------------------- 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: [email protected] With regards, Apache Git Services
