Skip to content

Commit

Permalink
try to fix W13 conflict, update default terminal: thread1:6->20, R2*:…
Browse files Browse the repository at this point in the history
…1->2, add a label to every query sql
  • Loading branch information
cococo2000 committed Feb 2, 2024
1 parent 7a2293e commit 2696b00
Show file tree
Hide file tree
Showing 29 changed files with 109 additions and 99 deletions.
2 changes: 1 addition & 1 deletion config/runR21.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<scalefactor>6000</scalefactor>

<!-- The workload -->
<terminals>1</terminals>
<terminals>2</terminals>
<works>
<work>
<warmup>0</warmup>
Expand Down
2 changes: 1 addition & 1 deletion config/runR22.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<scalefactor>6000</scalefactor>

<!-- The workload -->
<terminals>1</terminals>
<terminals>2</terminals>
<works>
<work>
<warmup>0</warmup>
Expand Down
2 changes: 1 addition & 1 deletion config/runR23.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<scalefactor>6000</scalefactor>

<!-- The workload -->
<terminals>1</terminals>
<terminals>2</terminals>
<works>
<work>
<warmup>0</warmup>
Expand Down
2 changes: 1 addition & 1 deletion config/runR24.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<scalefactor>6000</scalefactor>

<!-- The workload -->
<terminals>1</terminals>
<terminals>2</terminals>
<works>
<work>
<warmup>0</warmup>
Expand Down
2 changes: 1 addition & 1 deletion config/runR25.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<scalefactor>6000</scalefactor>

<!-- The workload -->
<terminals>1</terminals>
<terminals>2</terminals>
<works>
<work>
<warmup>0</warmup>
Expand Down
2 changes: 1 addition & 1 deletion config/runthread1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<scalefactor>6000</scalefactor>

<!-- The workload -->
<terminals>6</terminals>
<terminals>20</terminals>
<works>
<work>
<warmup>0</warmup>
Expand Down
2 changes: 0 additions & 2 deletions lib/README
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Dependencies

A new checkout of the repository should only contain 'ant-contrib.jar'.

Use `ant resolve` to automatically download all of the dependencies.

You can then put any DBMS-specific jar files in this directory as needed.
14 changes: 7 additions & 7 deletions script/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ new_password=
new_nodeid="main"
new_scalefactor=6000
# Test time in minutes
new_time=60
new_time=360
# terminals and rate for runthread1: R1, W1* and W4
new_terminals_thread1=6
new_terminals_thread1=20
# Total number of requests in one hour for R1 = 1000 * 6000 = 6000000
# then total rate per minute of thread1 = 1000 * 6000 / 80% / 60 = 1000 * 6000 / 48 = 125000
new_rate_thread1=125000
# terminals and rate for R2*
new_terminals_R21=1
new_terminals_R22=1
new_terminals_R23=1
new_terminals_R24=1
new_terminals_R25=1
new_terminals_R21=2
new_terminals_R22=2
new_terminals_R23=2
new_terminals_R24=2
new_terminals_R25=2
# Total number of requests per minute
# R21, R22, R23 = 10 * 6000 / 60 = 1000
new_rate_R21=1000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@ public class R1 extends WEB3Procedure {

// Equality on hash in transaction table
public SQLStmt query_stmtSQL = new SQLStmt(
"explain analyze select "
+ "to_address, from_address "
+ "from "
+ "transactions "
+ "where "
+ "hash = ? ");
"/* R1 */ "
+ "explain analyze "
+ "select to_address, from_address "
+ "from transactions "
+ "where hash = ? ");

private PreparedStatement query_stmt = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ public class R21 extends WEB3Procedure {

// top N with small N on full table scan
public SQLStmt query_stmtSQL = new SQLStmt(
"explain analyze select "
+ "* "
"/* R21 */ "
+ "explain analyze "
+ "select * "
+ "from token_transfers "
+ "where from_address = ? "
+ "order by block_number desc limit 5 ");
+ "order by block_number desc "
+ "limit 5 ");
private PreparedStatement query_stmt = null;

public long run(Connection conn, Random gen, WEB3Worker w, int startNumber, int upperLimit, int numScale,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@ public class R22 extends WEB3Procedure {

// Aggregation with no group by on a small range
public SQLStmt query_stmtSQL = new SQLStmt(
"explain analyze select "
+ "count(*) "
+ "from "
+ "token_transfers "
+ "where "
+ "token_address = ? ");
"/* R22 */ "
+ "explain analyze "
+ "select count(*) "
+ "from token_transfers "
+ "where token_address = ? ");
private PreparedStatement query_stmt = null;

public long run(Connection conn, Random gen, WEB3Worker w, int startNumber, int upperLimit, int numScale,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,15 @@ public class R23 extends WEB3Procedure {
private static final Logger LOG = Logger.getLogger(R23.class);

public SQLStmt query_stmtSQL = new SQLStmt(
"explain analyze select * "
+ "from "
+ "token_transfers "
+ "where "
+ "token_address = ? "
"/* R23 */ "
+ "explain analyze "
+ "select * "
+ "from token_transfers "
+ "where token_address = ? "
+ "and block_number <= ? "
+ "and (next_block_number > ? or next_block_number = ?) "
+ "order by block_number desc limit ?");
+ "order by block_number desc "
+ "limit ?");
private PreparedStatement query_stmt = null;

public long run(Connection conn, Random gen, WEB3Worker w, int startNumber, int upperLimit, int numScale,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@ public class R24 extends WEB3Procedure {

// List of transactions excluding some black listed ones.
public SQLStmt query_to_address_SQL = new SQLStmt(
"explain analyze select "
+ "count(*) "
+ "from "
+ "transactions "
+ "where "
+ "to_address not in (?, ?, ?) ");
"/* R24 */ "
+ "explain analyze "
+ "select count(*) "
+ "from transactions "
+ "where to_address not in (?, ?, ?) ");
private PreparedStatement query_stmt = null;

public long run(Connection conn, Random gen, WEB3Worker w, int startNumber, int upperLimit, int numScale,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ public class R25 extends WEB3Procedure {
// Constraint checking that next_block_number <= block_number in token_transfers
// Query result should be empty.
public SQLStmt query_SQL = new SQLStmt(
"explain analyze select "
+ "count(*) "
"/* R25 */ "
+ "explain analyze "
+ "select count(*) "
+ "from token_transfers "
+ "where "
+ "next_block_number <= block_number "
+ "where next_block_number <= block_number "
+ "group by next_block_number ");
private PreparedStatement query_stmt = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,13 @@ public class R31 extends WEB3Procedure {
// For a specific person, find transactions where this person is either a sender
// or receiver. Limit the result by the most recent timestamp.
public SQLStmt query_stmtSQL = new SQLStmt(
"explain analyze select "
+ "* "
+ "from "
+ "transactions "
+ "where "
+ "from_address = ? or to_address = ? "
+ "order by "
+ "block_timestamp desc limit 10");
"/* R31 */ "
+ "explain analyze "
+ "select * "
+ "from transactions "
+ "where from_address = ? or to_address = ? "
+ "order by block_timestamp desc "
+ "limit 10");
private PreparedStatement query_stmt = null;

public long run(Connection conn, Random gen, WEB3Worker w, int startNumber, int upperLimit, int numScale,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ public class R32 extends WEB3Procedure {

// Top N transactions based on block timestamp.
public SQLStmt query_stmtSQL = new SQLStmt(
"explain analyze select "
+ "* "
+ "from "
+ "transactions "
+ "order by "
+ "block_timestamp desc limit 100");
"/* R32 */ "
+ "explain analyze "
+ "select * "
+ "from transactions "
+ "order by block_timestamp desc "
+ "limit 100");
private PreparedStatement query_stmt = null;

public long run(Connection conn, Random gen, WEB3Worker w, int startNumber, int upperLimit, int numScale,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ public class R33 extends WEB3Procedure {

// Find the number of unique senders (from\_address) in transactions
public SQLStmt query_stmtSQL = new SQLStmt(
"explain analyze select "
+ "count(distinct from_address) "
+ "from "
+ "transactions ");
"/* R33 */ "
+ "explain analyze "
+ "select count(distinct from_address) "
+ "from transactions ");
private PreparedStatement query_stmt = null;

public long run(Connection conn, Random gen, WEB3Worker w, int startNumber, int upperLimit, int numScale,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,16 @@ public class R34 extends WEB3Procedure {

// Find top N senders (from\_address) by total transaction value
public SQLStmt query_stmtSQL = new SQLStmt(
"explain analyze select "
"/* R34 */ "
+ "explain analyze "
+ "select "
+ "sum(value) as totalamount, "
+ "count(value) as transactioncount, "
+ "from_address as fromaddress "
+ "from "
+ "transactions "
+ "from transactions "
+ "group by from_address "
+ "order by sum(value) desc limit 10");
+ "order by sum(value) desc "
+ "limit 10 ");
private PreparedStatement query_stmt = null;

public long run(Connection conn, Random gen, WEB3Worker w, int startNumber, int upperLimit, int numScale,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,17 @@ public class R35 extends WEB3Procedure {
// Total count of token transfers for a specific sender and token transfers for
// recipients who are also senders in other transactions.
public SQLStmt query_stmtSQL = new SQLStmt(
"explain analyze select "
+ "count(*) as count "
"/* R35 */ "
+ "explain analyze "
+ "select count(*) as count "
+ "from "
+ "( "
+ "select * "
+ "from "
+ "token_transfers t "
+ "where "
+ "from_address = ? "
+ "from token_transfers t "
+ "where from_address = ? "
+ "union all "
+ "select t2.* "
+ "from "
+ "token_transfers t2 "
+ "from token_transfers t2 "
+ "inner join token_transfers t on t2.from_address = t.to_address "
+ "and t.value < t2.value "
+ ") as temp ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ public class W11 extends WEB3Procedure {
private static final Logger LOG = Logger.getLogger(W11.class);

public SQLStmt query_stmtSQL = new SQLStmt(
"explain analyze insert into "
+ "blocks "
"/* W11 */ "
+ "explain analyze "
+ "insert into blocks "
+ "values "
+ "(?, ?, ?, ?, ?,"
+ " ?, ?, ?, ?, ?,"
Expand All @@ -54,7 +55,7 @@ public long run(Connection conn, Random gen, WEB3Worker w, int startNumber, int
query_stmt = this.getPreparedStatement(conn, query_stmtSQL);

long number = numScale * WEB3Config.configBlocksCount + startNumber;
String hash = WEB3Util.convertToBlockHashString(number, nodeid);
String hash = WEB3Util.convertToBlockHashString(startNumber, nodeid + "-W11");
String parent_hash = WEB3Util.convertToBlockHashString(number - 1);
String nonce = WEB3Util.randomHexString(42);
String sha3_uncles = WEB3Util.randomHashString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ public class W12 extends WEB3Procedure {
private static final Logger LOG = Logger.getLogger(W12.class);

public SQLStmt query_stmtSQL = new SQLStmt(
"explain analyze insert into "
+ "contracts "
"/* W12 */ "
+ "explain analyze "
+ "insert into contracts "
+ "values (?, ?, ?, ?, ?, ?) ");

private PreparedStatement query_stmt = null;
Expand All @@ -50,7 +51,7 @@ public long run(Connection conn, Random gen, WEB3Worker w, int startNumber, int
query_stmt = this.getPreparedStatement(conn, query_stmtSQL);

String address = WEB3Util
.convertToContractAddressString(numScale * WEB3Config.configContractsCount + startNumber, nodeid);
.convertToContractAddressString(startNumber, nodeid + "-W12");
String bytecode = WEB3Util.randomStr(WEB3Util.randomNumber(1, 1000, gen));
String function_sighashes = WEB3Util.randomStr(WEB3Util.randomNumber(1, 1000, gen));
boolean is_erc20 = false; // gen.nextBoolean();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ public class W13 extends WEB3Procedure {
private static final Logger LOG = Logger.getLogger(W13.class);

public SQLStmt query_stmtSQL = new SQLStmt(
"explain analyze insert into "
+ "transactions "
"/* W13 */ "
+ "explain analyze "
+ "insert into transactions "
+ "values "
+ "(?, ?, ?, ?, ?,"
+ " ?, ?, ?, ?, ?,"
Expand All @@ -53,9 +54,8 @@ public long run(Connection conn, Random gen, WEB3Worker w, int startNumber, int
// initializing all prepared statements
query_stmt = this.getPreparedStatement(conn, query_stmtSQL);

String hash = WEB3Util.convertToTxnHashString(
numScale * WEB3Config.configTransactionsCount + startNumber,
nodeid);
String hash = WEB3Util.convertToTxnHashString(startNumber, nodeid + "-W13");
LOG.info(startNumber);
long nonce = WEB3Util.randomNumber(0, 100, gen);
long block_number = WEB3Util.randomNumber(1, numScale * WEB3Config.configBlocksCount, gen);
String block_hash = WEB3Util.convertToBlockHashString(block_number);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ public class W14 extends WEB3Procedure {
private static final Logger LOG = Logger.getLogger(W14.class);

public SQLStmt query_stmtSQL = new SQLStmt(
"explain analyze insert into "
+ "token_transfers "
"/* W14 */ "
+ "explain analyze "
+ "insert into token_transfers "
+ "values "
+ "(?, ?, ?, ?, ?, ?, ?)");

Expand Down
Loading

0 comments on commit 2696b00

Please sign in to comment.