Skip to content

Commit

Permalink
New Benchmark: OtterTune Metrics (cmu-db#175)
Browse files Browse the repository at this point in the history
  • Loading branch information
apavlo authored Jun 2, 2022
1 parent 06392d6 commit c19acc1
Show file tree
Hide file tree
Showing 18 changed files with 939 additions and 6 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
strategy:
matrix:
# BROKEN: tpch
benchmark: [ 'epinions', 'hyadapt', 'noop', 'resourcestresser', 'seats', 'sibench', 'smallbank', 'tatp', 'tpcc', 'twitter', 'voter', 'wikipedia', 'ycsb' ]
benchmark: [ 'epinions', 'hyadapt', 'noop', 'otmetrics', 'resourcestresser', 'seats', 'sibench', 'smallbank', 'tatp', 'tpcc', 'twitter', 'voter', 'wikipedia', 'ycsb' ]
steps:
- name: Download artifact
uses: actions/download-artifact@v2
Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
benchmark: [ 'auctionmark', 'epinions', 'hyadapt', 'noop', 'resourcestresser', 'seats', 'sibench', 'smallbank', 'tatp', 'tpcc', 'tpch', 'twitter', 'voter', 'wikipedia', 'ycsb' ]
benchmark: [ 'auctionmark', 'epinions', 'hyadapt', 'noop', 'otmetrics', 'resourcestresser', 'seats', 'sibench', 'smallbank', 'tatp', 'tpcc', 'tpch', 'twitter', 'voter', 'wikipedia', 'ycsb' ]
services:
mariadb: # https://hub.docker.com/_/mariadb
image: mariadb:latest
Expand Down Expand Up @@ -157,7 +157,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
benchmark: [ 'auctionmark', 'epinions', 'hyadapt', 'noop', 'resourcestresser', 'seats', 'sibench', 'smallbank', 'tatp', 'tpcc', 'twitter', 'voter', 'wikipedia', 'ycsb' ]
benchmark: [ 'auctionmark', 'epinions', 'hyadapt', 'noop', 'otmetrics', 'resourcestresser', 'seats', 'sibench', 'smallbank', 'tatp', 'tpcc', 'twitter', 'voter', 'wikipedia', 'ycsb' ]
services:
mysql: # https://hub.docker.com/_/mysql
image: mysql:latest
Expand Down Expand Up @@ -208,7 +208,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
benchmark: [ 'auctionmark', 'epinions', 'hyadapt', 'noop', 'resourcestresser', 'seats', 'sibench', 'smallbank', 'tatp', 'tpcc', 'tpch', 'twitter', 'voter', 'wikipedia', 'ycsb' ]
benchmark: [ 'auctionmark', 'epinions', 'hyadapt', 'noop', 'otmetrics', 'resourcestresser', 'seats', 'sibench', 'smallbank', 'tatp', 'tpcc', 'tpch', 'twitter', 'voter', 'wikipedia', 'ycsb' ]
services:
postgres: # https://hub.docker.com/_/postgres
image: postgres:latest
Expand Down Expand Up @@ -257,7 +257,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
benchmark: [ 'auctionmark', 'epinions', 'hyadapt', 'noop', 'resourcestresser', 'seats', 'sibench', 'smallbank', 'tatp', 'tpcc', 'tpch', 'twitter', 'voter', 'wikipedia', 'ycsb' ]
benchmark: [ 'auctionmark', 'epinions', 'hyadapt', 'noop', 'otmetrics', 'resourcestresser', 'seats', 'sibench', 'smallbank', 'tatp', 'tpcc', 'tpch', 'twitter', 'voter', 'wikipedia', 'ycsb' ]
services:
cockroach: # https://hub.docker.com/repository/docker/timveil/cockroachdb-single-node
image: timveil/cockroachdb-single-node:latest
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ The BenchBase framework has the following benchmarks:
* [Epinions.com](https://github.com/cmu-db/benchbase/wiki/epinions)
* hyadapt -- pending configuration files
* [NoOp](https://github.com/cmu-db/benchbase/wiki/NoOp)
* [OT-Metrics](https://github.com/cmu-db/benchbase/wiki/OT-Metrics)
* [Resource Stresser](https://github.com/cmu-db/benchbase/wiki/Resource-Stresser)
* [SEATS](https://github.com/cmu-db/benchbase/wiki/Seats)
* [SIBench](https://github.com/cmu-db/benchbase/wiki/SIBench)
Expand Down Expand Up @@ -123,7 +124,7 @@ usage: benchbase
supported: [tpcc, tpch, tatp, wikipedia,
resourcestresser, twitter, epinions, ycsb,
seats, auctionmark, chbenchmark, voter,
sibench, noop, smallbank, hyadapt]
sibench, noop, smallbank, hyadapt, otmetrics]
-c,--config <arg> [required] Workload configuration file
--clear <arg> Clear all records in the database for this
benchmark
Expand Down
31 changes: 31 additions & 0 deletions config/cockroachdb/sample_otmetrics_config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0"?>
<parameters>

<!-- Connection details -->
<type>COCKROACHDB</type>
<driver>org.postgresql.Driver</driver>
<url>jdbc:postgresql://localhost:26257/benchbase?sslmode=disable&amp;ApplicationName=otmetrics&amp;reWriteBatchedInserts=true</url>
<username>admin</username>
<password>password</password>
<retries>4</retries>

<batchsize>2048</batchsize>
<scalefactor>0.1</scalefactor>

<!-- The workload -->
<terminals>1</terminals>
<works>
<work>
<time>60</time>
<rate>unlimited</rate>
<weights>100</weights>
</work>
</works>

<!-- Transaction Declaration -->
<transactiontypes>
<transactiontype>
<name>GetSessionRange</name>
</transactiontype>
</transactiontypes>
</parameters>
30 changes: 30 additions & 0 deletions config/mariadb/sample_otmetrics_config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0"?>
<parameters>

<!-- Connection details -->
<type>MARIADB</type>
<driver>org.mariadb.jdbc.Driver</driver>
<url>jdbc:mariadb://localhost:3306/benchbase?useServerPrepStmts</url>
<username>admin</username>
<password>password</password>

<batchsize>10000</batchsize>
<scalefactor>0.1</scalefactor>

<!-- The workload -->
<terminals>1</terminals>
<works>
<work>
<time>60</time>
<rate>unlimited</rate>
<weights>100</weights>
</work>
</works>

<!-- Transaction Declaration -->
<transactiontypes>
<transactiontype>
<name>GetSessionRange</name>
</transactiontype>
</transactiontypes>
</parameters>
30 changes: 30 additions & 0 deletions config/mysql/sample_otmetrics_config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0"?>
<parameters>

<!-- Connection details -->
<type>MYSQL</type>
<driver>com.mysql.cj.jdbc.Driver</driver>
<url>jdbc:mysql://localhost:3306/benchbase?rewriteBatchedStatements=true&amp;sslMode=DISABLED</url>
<username>admin</username>
<password>password</password>

<batchsize>2048</batchsize>
<scalefactor>0.1</scalefactor>

<!-- The workload -->
<terminals>1</terminals>
<works>
<work>
<time>60</time>
<rate>unlimited</rate>
<weights>100</weights>
</work>
</works>

<!-- Transaction Declaration -->
<transactiontypes>
<transactiontype>
<name>GetSessionRange</name>
</transactiontype>
</transactiontypes>
</parameters>
1 change: 1 addition & 0 deletions config/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@
<plugin name="noop">com.oltpbenchmark.benchmarks.noop.NoOpBenchmark</plugin>
<plugin name="smallbank">com.oltpbenchmark.benchmarks.smallbank.SmallBankBenchmark</plugin>
<plugin name="hyadapt">com.oltpbenchmark.benchmarks.hyadapt.HYADAPTBenchmark</plugin>
<plugin name="otmetrics">com.oltpbenchmark.benchmarks.otmetrics.OTMetricsBenchmark</plugin>
</plugins>
30 changes: 30 additions & 0 deletions config/postgres/sample_otmetrics_config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0"?>
<parameters>

<!-- Connection details -->
<type>POSTGRES</type>
<driver>org.postgresql.Driver</driver>
<url>jdbc:postgresql://localhost:5432/benchbase?sslmode=disable&amp;ApplicationName=otmetrics&amp;reWriteBatchedInserts=true</url>
<username>admin</username>
<password>password</password>

<batchsize>2048</batchsize>
<scalefactor>0.1</scalefactor>

<!-- The workload -->
<terminals>1</terminals>
<works>
<work>
<time>60</time>
<rate>unlimited</rate>
<weights>100</weights>
</work>
</works>

<!-- Transaction Declaration -->
<transactiontypes>
<transactiontype>
<name>GetSessionRange</name>
</transactiontype>
</transactiontypes>
</parameters>
31 changes: 31 additions & 0 deletions config/sqlite/sample_otmetrics_config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0"?>
<parameters>

<!-- Connection details -->
<type>SQLITE</type>
<driver>org.sqlite.JDBC</driver>
<url>jdbc:sqlite:otmetrics.db</url>
<isolation>TRANSACTION_SERIALIZABLE</isolation>
<batchsize>10000</batchsize>
<scalefactor>0.01</scalefactor>

<!-- SQLITE only supports one writer thread -->
<loaderThreads>1</loaderThreads>

<!-- The workload -->
<terminals>1</terminals>
<works>
<work>
<time>60</time>
<rate>unlimited</rate>
<weights>100</weights>
</work>
</works>

<!-- Transaction Declaration -->
<transactiontypes>
<transactiontype>
<name>GetSessionRange</name>
</transactiontype>
</transactiontypes>
</parameters>
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* Copyright 2022 by OLTPBenchmark Project
*
* Licensed 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 com.oltpbenchmark.benchmarks.otmetrics;

import com.oltpbenchmark.WorkloadConfiguration;
import com.oltpbenchmark.api.BenchmarkModule;
import com.oltpbenchmark.api.Loader;
import com.oltpbenchmark.api.Worker;
import com.oltpbenchmark.benchmarks.otmetrics.procedures.GetSessionRange;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.List;

/**
* OtterTune Metrics Timeseries Benchmark
* @author pavlo
*/
public class OTMetricsBenchmark extends BenchmarkModule {

private static final Logger LOG = LoggerFactory.getLogger(OTMetricsBenchmark.class);

protected final int num_sources;
protected final int num_sessions;
protected final long num_observations;

public OTMetricsBenchmark(WorkloadConfiguration workConf) {
super(workConf);

// Compute the number of records per table.
this.num_sources = (int) Math.round(OTMetricsConstants.NUM_SOURCES * workConf.getScaleFactor());
this.num_sessions = (int) Math.round(OTMetricsConstants.NUM_SESSIONS * workConf.getScaleFactor());
this.num_observations = (long) Math.round(OTMetricsConstants.NUM_OBSERVATIONS * workConf.getScaleFactor());
}

@Override
protected Package getProcedurePackageImpl() {
return GetSessionRange.class.getPackage();
}

@Override
protected List<Worker<? extends BenchmarkModule>> makeWorkersImpl() {
List<Worker<? extends BenchmarkModule>> workers = new ArrayList<>();
for (int i = 0; i < workConf.getTerminals(); ++i) {
workers.add(new OTMetricsWorker(this, i));
}
return workers;
}

@Override
protected Loader<OTMetricsBenchmark> makeLoaderImpl() {
return new OTMetricsLoader(this);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright 2020 by OLTPBenchmark Project
*
* Licensed 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 com.oltpbenchmark.benchmarks.otmetrics;

import java.time.LocalDateTime;
import java.time.Month;

public abstract class OTMetricsConstants {

/**
* Table Names
*/
public static final String TABLENAME_SOURCES = "sources";
public static final String TABLENAME_SESSIONS = "sessions";
public static final String TABLENAME_TYPES = "types";
public static final String TABLENAME_OBSERVATIONS = "observations";

/**
* Number of records per table.
* All of the tables in this benchmark will scale as you change the benchmark scalefactor
*/
public static final int NUM_SOURCES = 100;
public static final int NUM_SESSIONS = 1000;
public static final int NUM_TYPES = 500; // FIXED SIZE
public static final int NUM_OBSERVATIONS = 10000;

/**
* All objects in the database will be created starting after this date
*/
public static final LocalDateTime START_DATE = LocalDateTime.of(2022, Month.JANUARY, 1, 0, 0);

}
Loading

0 comments on commit c19acc1

Please sign in to comment.