Skip to content

Commit

Permalink
Improvements for benchmarking Polypheny (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
vogti authored Jun 7, 2022
1 parent 41236ee commit bc159b1
Show file tree
Hide file tree
Showing 17 changed files with 198 additions and 112 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ cache:
# openjdk9 + oraclejdk10 were both removed from Ubuntu
language: java
jdk:
- openjdk17
- openjdk11
- openjdk10
- openjdk8
# - oraclejdk8

Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ Please consult the documentation of the original repository on how to further us

### Supported Benchmarks for Polypheny
#### [Polypheny-DB](https://github.com/polypheny/Polypheny-DB)
* [AuctionMark](./config/polypheny-db/auctionmark.xml)\
* [AuctionMark](./config/polypheny/auctionmark.xml)\
`./bin/oltpbenchmark -b auctionmark -c ./config/polypheny-db/auctionmark.xml --create=true --load=true --execute=true`
* [SmallBank](./config/polypheny-db/smallbank.xml)\
* [SmallBank](./config/polypheny/smallbank.xml)\
`./bin/oltpbenchmark -b smallbank -c ./config/polypheny-db/smallbank.xml --create=true --load=true --execute=true`
* [TPC-C](./config/polypheny-db/tpcc.xml)\
* [TPC-C](./config/polypheny/tpcc.xml)\
`./bin/oltpbenchmark -b tpcc -c ./config/polypheny-db/tpcc.xml --create=true --load=true --execute=true`
* [TPC-H](./config/polypheny-db/tpch.xml)\
* [TPC-H](./config/polypheny/tpch.xml)\
`./bin/oltpbenchmark -b tpch -c ./config/polypheny-db/tpch.xml --create=true --load=true --execute=true`
* [YCSB](./config/polypheny-db/ycsb.xml)\
* [YCSB](./config/polypheny/ycsb.xml)\
`./bin/oltpbenchmark -b ycsb -c ./config/polypheny-db/ycsb.xml --create=true --load=true --execute=true`

#### [Polypheny-FRAM](https://github.com/polypheny/Polypheny-FRAM)
Expand Down
4 changes: 3 additions & 1 deletion config/polypheny-fram/smallbank.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

<isolation>TRANSACTION_SERIALIZABLE</isolation>
<batchsize>128</batchsize>


<ddlFileName>smallbank-polypheny-fram-ddl.sql</ddlFileName>

<scalefactor>1</scalefactor>

<!-- The workload -->
Expand Down
4 changes: 4 additions & 0 deletions config/polypheny-fram/tpcc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
<isolation>TRANSACTION_SERIALIZABLE</isolation>
<batchsize>128</batchsize>

<!-- Use this file present in the tpcc/ddls folder -->
<!-- The name needs to start with "<benchmark>-<dbtype>" and end with "-ddl.sql". -->
<ddlFileName>tpcc-polypheny-fram-ddl.sql</ddlFileName>

<!-- Scale factor is the number of warehouses in TPCC -->
<scalefactor>1</scalefactor>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
<!-- Scalefactor in AuctionMark scales by *1000 the number of customers-->
<scalefactor>10</scalefactor>

<dialectFileName>polypheny-dialects.xml</dialectFileName>

<!-- The workload -->
<terminals>1</terminals>
<works>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<username>pa</username>
<password></password>

<ddlFileName>smallbank-polypheny-db-ddl.sql</ddlFileName>
<ddlFileName>smallbank-polypheny-ddl.sql</ddlFileName>

<isolation>TRANSACTION_SERIALIZABLE</isolation>
<batchsize>128</batchsize>
Expand Down
2 changes: 1 addition & 1 deletion config/polypheny-db/tpcc.xml → config/polypheny/tpcc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<!-- Use this file present in the tpcc/ddls folder -->
<!-- The name needs to start with "<benchmark>-<dbtype>" and end with "-ddl.sql". -->
<ddlFileName>tpcc-polypheny-db-ddl.sql</ddlFileName>
<ddlFileName>tpcc-polypheny-ddl.sql</ddlFileName>

<!-- Use this file present in the tpcc/dialects folder -->
<!-- The name needs to end with "-dialects.xml". -->
Expand Down
File renamed without changes.
File renamed without changes.
69 changes: 34 additions & 35 deletions src/com/oltpbenchmark/benchmarks/auctionmark/AuctionMarkLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,29 @@

package com.oltpbenchmark.benchmarks.auctionmark;

import java.io.File;
import com.oltpbenchmark.api.Loader;
import com.oltpbenchmark.benchmarks.auctionmark.util.Category;
import com.oltpbenchmark.benchmarks.auctionmark.util.CategoryParser;
import com.oltpbenchmark.benchmarks.auctionmark.util.GlobalAttributeGroupId;
import com.oltpbenchmark.benchmarks.auctionmark.util.GlobalAttributeValueId;
import com.oltpbenchmark.benchmarks.auctionmark.util.ItemId;
import com.oltpbenchmark.benchmarks.auctionmark.util.ItemStatus;
import com.oltpbenchmark.benchmarks.auctionmark.util.LoaderItemInfo;
import com.oltpbenchmark.benchmarks.auctionmark.util.UserId;
import com.oltpbenchmark.benchmarks.auctionmark.util.UserIdGenerator;
import com.oltpbenchmark.catalog.Column;
import com.oltpbenchmark.catalog.Table;
import com.oltpbenchmark.util.CollectionUtil;
import com.oltpbenchmark.util.CompositeId;
import com.oltpbenchmark.util.Histogram;
import com.oltpbenchmark.util.Pair;
import com.oltpbenchmark.util.RandomDistribution.Flat;
import com.oltpbenchmark.util.RandomDistribution.Zipf;
import com.oltpbenchmark.util.SQLUtil;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Field;
import java.nio.charset.StandardCharsets;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
Expand All @@ -36,31 +57,11 @@
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;

import java.util.zip.GZIPInputStream;
import org.apache.commons.collections15.CollectionUtils;
import org.apache.commons.collections15.map.ListOrderedMap;
import org.apache.log4j.Logger;

import com.oltpbenchmark.api.Loader;
import com.oltpbenchmark.benchmarks.auctionmark.util.Category;
import com.oltpbenchmark.benchmarks.auctionmark.util.CategoryParser;
import com.oltpbenchmark.benchmarks.auctionmark.util.GlobalAttributeGroupId;
import com.oltpbenchmark.benchmarks.auctionmark.util.GlobalAttributeValueId;
import com.oltpbenchmark.benchmarks.auctionmark.util.ItemId;
import com.oltpbenchmark.benchmarks.auctionmark.util.ItemStatus;
import com.oltpbenchmark.benchmarks.auctionmark.util.LoaderItemInfo;
import com.oltpbenchmark.benchmarks.auctionmark.util.UserId;
import com.oltpbenchmark.benchmarks.auctionmark.util.UserIdGenerator;
import com.oltpbenchmark.catalog.Column;
import com.oltpbenchmark.catalog.Table;
import com.oltpbenchmark.util.CollectionUtil;
import com.oltpbenchmark.util.CompositeId;
import com.oltpbenchmark.util.Histogram;
import com.oltpbenchmark.util.Pair;
import com.oltpbenchmark.util.RandomDistribution.Flat;
import com.oltpbenchmark.util.RandomDistribution.Zipf;
import com.oltpbenchmark.util.SQLUtil;

/**
* @author pavlo
* @author visawee
Expand All @@ -86,7 +87,7 @@ public class AuctionMarkLoader extends Loader<AuctionMarkBenchmark> {

private final Histogram<String> tableSizes = new Histogram<String>();

private final File category_file;
private final InputStreamReader category_reader;

private boolean fail = false;

Expand All @@ -96,24 +97,26 @@ public class AuctionMarkLoader extends Loader<AuctionMarkBenchmark> {

/**
* Constructor
*
* @param args
*/
public AuctionMarkLoader(AuctionMarkBenchmark benchmark) {
super(benchmark);

// BenchmarkProfile
this.profile = new AuctionMarkProfile(benchmark, benchmark.getRandomGenerator());

this.category_file = new File(benchmark.getDataDir().getAbsolutePath() + "/table.category.gz");
try {
this.category_reader = new InputStreamReader( new GZIPInputStream(AuctionMarkBenchmark.class.getResourceAsStream( "data/table.category.gz" )), StandardCharsets.UTF_8 ); // new File(benchmark.getDataDir().getAbsolutePath() + "/table.category.gz");
} catch ( IOException e ) {
throw new RuntimeException( e );
}

try {
// ---------------------------
// Fixed-Size Table Generators
// ---------------------------

this.registerGenerator(new RegionGenerator());
this.registerGenerator(new CategoryGenerator(category_file));
this.registerGenerator(new CategoryGenerator(category_reader));
this.registerGenerator(new GlobalAttributeGroupGenerator());
this.registerGenerator(new GlobalAttributeValueGenerator());

Expand Down Expand Up @@ -322,7 +325,6 @@ protected abstract class AbstractTableGenerator extends LoaderThread {

/**
* Constructor
* @param catalog_tbl
*/
public AbstractTableGenerator(String tableName, String...dependencies) throws SQLException {
super();
Expand Down Expand Up @@ -712,17 +714,14 @@ protected int populateRow(Object[] row) {
* CATEGORY Generator
**********************************************************************************************/
protected class CategoryGenerator extends AbstractTableGenerator {
private final File data_file;
private final InputStreamReader reader;
private final Map<String, Category> categoryMap;
private final LinkedList<Category> categories = new LinkedList<Category>();

public CategoryGenerator(File data_file) throws SQLException {
public CategoryGenerator( InputStreamReader reader) throws SQLException {
super(AuctionMarkConstants.TABLENAME_CATEGORY);
this.data_file = data_file;
assert(this.data_file.exists()) :
"The data file for the category generator does not exist: " + this.data_file;

this.categoryMap = (new CategoryParser(data_file)).getCategoryMap();
this.reader = reader;
this.categoryMap = (new CategoryParser(reader)).getCategoryMap();
this.tableSize = (long)this.categoryMap.size();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ CREATE TABLE useracct (
u_sattr5 VARCHAR(64),
u_sattr6 VARCHAR(64),
u_sattr7 VARCHAR(64),
u_iattr0 BIGINT DEFAULT NULL,
u_iattr1 BIGINT DEFAULT NULL,
u_iattr2 BIGINT DEFAULT NULL,
u_iattr3 BIGINT DEFAULT NULL,
u_iattr4 BIGINT DEFAULT NULL,
u_iattr5 BIGINT DEFAULT NULL,
u_iattr6 BIGINT DEFAULT NULL,
u_iattr7 BIGINT DEFAULT NULL,
u_iattr0 BIGINT NULL,
u_iattr1 BIGINT NULL,
u_iattr2 BIGINT NULL,
u_iattr3 BIGINT NULL,
u_iattr4 BIGINT NULL,
u_iattr5 BIGINT NULL,
u_iattr6 BIGINT NULL,
u_iattr7 BIGINT NULL,
PRIMARY KEY (u_id)
);
ALTER TABLE useracct ADD CONSTRAINT C_FKEY_USERACCT_REGION FOREIGN KEY (u_r_id) REFERENCES region (r_id) ON DELETE RESTRICT;
Expand Down Expand Up @@ -166,7 +166,7 @@ CREATE TABLE item (
i_c_id BIGINT NOT NULL,
i_name VARCHAR(100),
i_description VARCHAR(1024),
i_user_attributes VARCHAR(255) DEFAULT NULL,
i_user_attributes VARCHAR(255) NULL,
i_initial_price REAL NOT NULL,
i_current_price REAL NOT NULL,
i_num_bids BIGINT,
Expand All @@ -178,14 +178,14 @@ CREATE TABLE item (
i_status INTEGER DEFAULT 0,
i_created TIMESTAMP,
i_updated TIMESTAMP,
i_iattr0 BIGINT DEFAULT NULL,
i_iattr1 BIGINT DEFAULT NULL,
i_iattr2 BIGINT DEFAULT NULL,
i_iattr3 BIGINT DEFAULT NULL,
i_iattr4 BIGINT DEFAULT NULL,
i_iattr5 BIGINT DEFAULT NULL,
i_iattr6 BIGINT DEFAULT NULL,
i_iattr7 BIGINT DEFAULT NULL,
i_iattr0 BIGINT NULL,
i_iattr1 BIGINT NULL,
i_iattr2 BIGINT NULL,
i_iattr3 BIGINT NULL,
i_iattr4 BIGINT NULL,
i_iattr5 BIGINT NULL,
i_iattr6 BIGINT NULL,
i_iattr7 BIGINT NULL,
PRIMARY KEY (i_id, i_u_id)
);
ALTER TABLE item ADD CONSTRAINT C_FKEY_ITEM_ACCT FOREIGN KEY (i_u_id) REFERENCES useracct (u_id) ON DELETE RESTRICT;
Expand All @@ -205,7 +205,7 @@ CREATE TABLE item_attribute (
ia_u_id BIGINT NOT NULL,
ia_gav_id BIGINT NOT NULL,
ia_gag_id BIGINT NOT NULL,
ia_sattr0 VARCHAR(64) DEFAULT NULL,
ia_sattr0 VARCHAR(64) NULL,
PRIMARY KEY (ia_id, ia_i_id, ia_u_id)
);
ALTER TABLE item_attribute ADD CONSTRAINT C_FKEY_ITEM_ATTRIBUTE_ITEM FOREIGN KEY (ia_i_id, ia_u_id) REFERENCES item (i_id, i_u_id) ON DELETE RESTRICT;
Expand Down Expand Up @@ -243,7 +243,7 @@ CREATE TABLE item_comment (
ic_u_id BIGINT NOT NULL,
ic_buyer_id BIGINT NOT NULL,
ic_question VARCHAR(128) NOT NULL,
ic_response VARCHAR(128) DEFAULT NULL,
ic_response VARCHAR(128) NULL,
ic_created TIMESTAMP,
ic_updated TIMESTAMP,
PRIMARY KEY (ic_id, ic_i_id, ic_u_id)
Expand Down
Loading

0 comments on commit bc159b1

Please sign in to comment.