Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding the keying/think time to each transaction. #7

Merged
merged 2 commits into from
Apr 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion config/workload_all.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@
</transactiontype>
</transactiontypes>

<terminals>2</terminals>
<scalefactor>2</scalefactor>
<!-- TPC-C 4.2.2: The number of terminals should be 10 per warehouse -->
<terminals>20</terminals>
<useKeyingTime>true</useKeyingTime>
<useThinkTime>true</useThinkTime>
<works>
<work>
<time>30</time>
Expand Down
7 changes: 7 additions & 0 deletions src/com/oltpbenchmark/DBWorkload.java
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,13 @@ public static void main(String[] args) throws Exception {
// Nothing to do here !
}

try {
wrkld.setUseKeyingTime(xmlConfig.getBoolean("useKeyingTime"));
wrkld.setUseThinkTime(xmlConfig.getBoolean("useThinkTime"));
} catch(NoSuchElementException nse) {
// Nothing to do here !
}

// ----------------------------------------------------------------
// CREATE BENCHMARK MODULE
// ----------------------------------------------------------------
Expand Down
75 changes: 46 additions & 29 deletions src/com/oltpbenchmark/WorkloadConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
import com.oltpbenchmark.util.ThreadUtil;

public class WorkloadConfiguration {
private DatabaseType db_type;

private DatabaseType db_type;
private String benchmarkName;
public String getBenchmarkName() {
return benchmarkName;
Expand All @@ -47,20 +47,23 @@ public void setBenchmarkName(String benchmarkName) {
private String db_name;
private String db_username;
private String db_password;
private String db_driver;
private String db_driver;
private double scaleFactor = 1.0;
private double selectivity = -1.0;
private int terminals;
private int loaderThreads = ThreadUtil.availableProcessors();
private int numTxnTypes;
private TraceReader traceReader = null;
private boolean useKeyingTime = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With these defaults, we'll use keying and think time for other workloads like workload_1, workload_2 etc. also. Just want to make sure that it's intentional.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

workload_all should be what we should run now. And all of our defaults should be to make it run easy for that.
For the other workloads we can still make it false and then run it.

private boolean useThinkTime = true;

public TraceReader getTraceReader() {
return traceReader;
}
public void setTraceReader(TraceReader traceReader) {
this.traceReader = traceReader;
}

private XMLConfiguration xmlConfig = null;

private List<Phase> works = new ArrayList<Phase>();
Expand All @@ -69,7 +72,7 @@ public void setTraceReader(TraceReader traceReader) {
public WorkloadState getWorkloadState() {
return workloadState;
}

/**
* Initiate a new benchmark and workload state
*/
Expand All @@ -85,106 +88,104 @@ public WorkloadState initializeState(BenchmarkState benchmarkState) {
private boolean recordAbortMessages = false;
private String dataDir = null;



public void addWork(int time, int warmup, int rate, List<String> weights, boolean rateLimited, boolean disabled, boolean serial, boolean timed, int active_terminals, Phase.Arrival arrival) {
works.add(new Phase(benchmarkName, numberOfPhases, time, warmup, rate, weights, rateLimited, disabled, serial, timed, active_terminals, arrival));
numberOfPhases++;
}

public void setDBType(DatabaseType dbType) {
db_type = dbType;
}

public DatabaseType getDBType() {
return db_type;
}

public void setDBConnection(String database) {
this.db_connection = database;
}

public String getDBConnection() {
return db_connection;
}

public void setDBName(String dbname) {
this.db_name = dbname;
}

public void setLoaderThreads(int loaderThreads) {
this.loaderThreads = loaderThreads;
}

/**
* The number of loader threads that the framework is allowed to use.
* @return
*/
public int getLoaderThreads() {
return this.loaderThreads;
}

public int getNumTxnTypes() {
return numTxnTypes;
}

public void setNumTxnTypes(int numTxnTypes) {
this.numTxnTypes = numTxnTypes;
}

public String getDBName() {
return db_name;
}

public void setDBUsername(String username) {
this.db_username = username;
}

public String getDBUsername() {
return db_username;
}

public void setDBPassword(String password) {
this.db_password = password;
}

public String getDBPassword() {
return this.db_password;
}

public void setSelectivity(double selectivity) {
this.selectivity = selectivity;
}

public double getSelectivity() {
return this.selectivity;
}

public void setDBDriver(String driver) {
this.db_driver = driver;
}

public String getDBDriver() {
return this.db_driver;
}

public void setRecordAbortMessages(boolean recordAbortMessages) {
this.recordAbortMessages = recordAbortMessages;
}

/**
* Whether each worker should record the transaction's UserAbort messages
* This primarily useful for debugging a benchmark
*/
public boolean getRecordAbortMessages() {
return (this.recordAbortMessages);
}

/**
* Set the scale factor for the database
* A value of 1 means the default size.
* A value greater than 1 means the database is larger
* A value less than 1 means the database is smaller
* A value less than 1 means the database is smaller
* @param scaleFactor
*/
public void setScaleFactor(double scaleFactor) {
Expand All @@ -209,15 +210,15 @@ public int getNumberOfPhases() {
/**
* Set the directory in which we can find the data files (for example, CSV
* files) for loading the database.
*/
*/
public void setDataDir(String dir) {
this.dataDir = dir;
}

/**
* Return the directory in which we can find the data files (for example, CSV
* files) for loading the database.
*/
*/
public String getDataDir() {
return this.dataDir;
}
Expand All @@ -240,7 +241,7 @@ public void setTerminals(int terminals) {
public int getTerminals() {
return terminals;
}

public TransactionTypes getTransTypes() {
return transTypes;
}
Expand Down Expand Up @@ -290,7 +291,23 @@ else if(mode.equals("TRANSACTION_READ_UNCOMMITTED"))
else if(!mode.isEmpty())
System.out.println("Indefined isolation mode, set to default [TRANSACTION_SERIALIZABLE]");
}


public boolean getUseKeyingTime() {
return useKeyingTime;
}

public void setUseKeyingTime(boolean useKeyingTime) {
this.useKeyingTime = useKeyingTime;
}

public boolean getUseThinkTime() {
return useThinkTime;
}

public void setUseThinkTime(boolean useThinkTime) {
this.useThinkTime = useThinkTime;
}

@Override
public String toString() {
Class<?> confClass = this.getClass();
Expand Down
Loading