Add standalone performance test.
Change-Id: Iaffcbaaaad2f798402742740b8ac12f9cf41a52c
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1070
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Ian Maxon <imaxon@apache.org>
diff --git a/asterixdb/asterix-experiments/src/main/java/org/apache/asterix/experiment/builder/PresetClusterPerfBuilder.java b/asterixdb/asterix-experiments/src/main/java/org/apache/asterix/experiment/builder/PresetClusterPerfBuilder.java
new file mode 100644
index 0000000..5c136d6
--- /dev/null
+++ b/asterixdb/asterix-experiments/src/main/java/org/apache/asterix/experiment/builder/PresetClusterPerfBuilder.java
@@ -0,0 +1,134 @@
+/*
+ * 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.asterix.experiment.builder;
+
+import org.apache.asterix.experiment.action.base.SequentialActionList;
+import org.apache.asterix.experiment.action.derived.RunAQLFileAction;
+import org.apache.asterix.experiment.action.derived.RunSQLPPFileAction;
+import org.apache.asterix.experiment.action.derived.SleepAction;
+import org.apache.asterix.experiment.action.derived.TimedAction;
+import org.apache.asterix.experiment.client.LSMExperimentConstants;
+import org.apache.asterix.experiment.client.LSMExperimentSetRunner.LSMExperimentSetRunnerConfig;
+import org.apache.asterix.experiment.client.LSMPerfConstants;
+import org.apache.http.client.HttpClient;
+import org.apache.http.impl.client.DefaultHttpClient;
+
+import javax.xml.bind.JAXBException;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Scanner;
+
+/**
+ * This experiment simply runs the performance benchmark queries against
+ * a cluster which is presumed to already be running.
+ * Also, there is no orchestration server involved in this experiment builder.
+ *
+ * The only LSMExperimentSetRunner config command-line options used by this
+ * experiment are:
+ * -ler -rh -rp
+ */
+public class PresetClusterPerfBuilder extends AbstractExperimentBuilder {
+
+ protected final HttpClient httpClient;
+
+ protected final String restHost;
+
+ protected final int restPort;
+
+ protected final Path localExperimentRoot;
+
+ private final String countFileName;
+
+ protected final String loadAQLFilePath;
+
+ protected final String querySQLPPFileName;
+
+ public PresetClusterPerfBuilder(LSMExperimentSetRunnerConfig config) {
+ super("PresetClusterPerfBuilder");
+ this.httpClient = new DefaultHttpClient();
+ this.restHost = config.getRESTHost();
+ this.restPort = config.getRESTPort();
+ this.localExperimentRoot = Paths.get(config.getLocalExperimentRoot());
+ this.countFileName = "bench_count.aql";
+ this.loadAQLFilePath = "bench_3_load_2.aql";
+ this.querySQLPPFileName = "agg_bench";
+ }
+
+ @Override
+ protected void doBuild(Experiment e) throws IOException, JAXBException {
+ SequentialActionList execs = new SequentialActionList();
+
+ //ddl statements
+ execs.add(new SleepAction(15000));
+ // TODO: implement retry handler
+ execs.add(new RunAQLFileAction(httpClient, restHost, restPort, localExperimentRoot.resolve(
+ LSMExperimentConstants.AQL_DIR).resolve(LSMPerfConstants.BASE_TYPES)));
+ execs.add(new RunAQLFileAction(httpClient, restHost, restPort, localExperimentRoot.resolve(
+ LSMExperimentConstants.AQL_DIR).resolve("bench_3.aql")));
+
+ //---------- main experiment body begins -----------
+
+ //run DDL + Load
+ execs.add(new TimedAction(new RunAQLFileAction(httpClient, restHost, restPort, localExperimentRoot.resolve(
+ LSMExperimentConstants.AQL_DIR).resolve(loadAQLFilePath))));
+
+ //execute SQL++ Queries
+ execs.add(new TimedAction(new RunSQLPPFileAction(httpClient, restHost, restPort, localExperimentRoot.resolve(
+ LSMExperimentConstants.AQL_DIR).resolve(querySQLPPFileName),
+ localExperimentRoot.resolve(LSMPerfConstants.RESULT_FILE))));
+
+ //---------- main experiment body ends -----------
+
+ //total record count
+ execs.add(new SleepAction(10000));
+ if (countFileName != null) {
+ execs.add(new RunAQLFileAction(httpClient, restHost, restPort, localExperimentRoot.resolve(
+ LSMExperimentConstants.AQL_DIR).resolve(countFileName)));
+ }
+
+ e.addBody(execs);
+ }
+
+ protected Map<String, List<String>> readDatagenPairs(Path p) throws IOException {
+ Map<String, List<String>> dgenPairs = new HashMap<>();
+ Scanner s = new Scanner(p, StandardCharsets.UTF_8.name());
+ try {
+ while (s.hasNextLine()) {
+ String line = s.nextLine();
+ String[] pair = line.split("\\s+");
+ List<String> vals = dgenPairs.get(pair[0]);
+ if (vals == null) {
+ vals = new ArrayList<>();
+ dgenPairs.put(pair[0], vals);
+ }
+ vals.add(pair[1]);
+ }
+ } finally {
+ s.close();
+ }
+ return dgenPairs;
+ }
+}
diff --git a/asterixdb/asterix-experiments/src/main/java/org/apache/asterix/experiment/client/LSMExperimentSetRunner.java b/asterixdb/asterix-experiments/src/main/java/org/apache/asterix/experiment/client/LSMExperimentSetRunner.java
index 9f9115e..45073d9 100644
--- a/asterixdb/asterix-experiments/src/main/java/org/apache/asterix/experiment/client/LSMExperimentSetRunner.java
+++ b/asterixdb/asterix-experiments/src/main/java/org/apache/asterix/experiment/client/LSMExperimentSetRunner.java
@@ -28,6 +28,7 @@
import org.apache.asterix.experiment.action.base.SequentialActionList;
import org.apache.asterix.experiment.builder.AbstractExperimentBuilder;
import org.apache.asterix.experiment.builder.PerfTestAggBuilder;
+import org.apache.asterix.experiment.builder.PresetClusterPerfBuilder;
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
import org.kohsuke.args4j.Option;
@@ -104,14 +105,14 @@
return sshKeyLocation;
}
- @Option(name = "-d", aliases = "--datagen-duartion", usage = "Data generation duration in seconds", metaVar = "DATAGENDURATION")
+ @Option(name = "-d", aliases = "--datagen-duration", usage = "Data generation duration in seconds", metaVar = "DATAGENDURATION")
private int duration;
public int getDuration() {
return duration;
}
- @Option(name = "-qd", aliases = "--querygen-duartion", usage = "Query generation duration in seconds", metaVar = "QUERYGENDURATION")
+ @Option(name = "-qd", aliases = "--querygen-duration", usage = "Query generation duration in seconds", metaVar = "QUERYGENDURATION")
private int queryDuration;
public int getQueryDuration() {
@@ -287,6 +288,7 @@
suite.add(new Experiment5DBuilder(config));
*/
suite.add(new PerfTestAggBuilder(config));
+ suite.add(new PresetClusterPerfBuilder(config));
Pattern p = config.getRegex() == null ? null : Pattern.compile(config.getRegex());
diff --git a/asterixdb/asterix-experiments/src/main/resources/ingestion-experiment-binary-and-configs/aql/bench_3_load_2.aql b/asterixdb/asterix-experiments/src/main/resources/ingestion-experiment-binary-and-configs/aql/bench_3_load_2.aql
new file mode 100644
index 0000000..5379ec2
--- /dev/null
+++ b/asterixdb/asterix-experiments/src/main/resources/ingestion-experiment-binary-and-configs/aql/bench_3_load_2.aql
@@ -0,0 +1,7 @@
+use dataverse SocialNetworkData;
+
+load dataset GleambookMessages using
+localfs(("path"="172.23.100.190:///hd1/datagen/gbook_messages.adm,172.23.100.191:///hd1/datagen/gbook_messages.adm,172.23.100.192:///hd1/datagen/gbook_messages.adm,172.23.100.193:///hd1/datagen/gbook_messages.adm"),("format"="adm"));
+
+load dataset GleambookUsers using
+localfs(("path"="172.23.100.190:///hd1/datagen/gbook_users.adm,172.23.100.191:///hd1/datagen/gbook_users.adm,172.23.100.192:///hd1/datagen/gbook_users.adm,172.23.100.193:///hd1/datagen/gbook_users.adm"),("format"="adm"));