Skip to content

Commit 727d5e9

Browse files
committed
Add config parameters to run only on a range of warehouses
Add config parameters useWarehouseFrom and useWarehouseTo to be able to perform a benchmark run on only a range of the total configured warehouses. This is intended to run BenchmarkSQL on a distributed database setup and separate the warehouses onto different "home nodes". In such a setup only the CUSTOMER and STOCK tables will experience update-update conflicts on the PAYMENT and NEW_ORDER transactions respectively.
1 parent 8a3c1a3 commit 727d5e9

6 files changed

Lines changed: 28 additions & 5 deletions

File tree

src/main/java/com/github/pgsqlio/benchmarksql/jtpcc/jTPCC.java

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ public class jTPCC {
4747

4848
public static int dbType;
4949
public static int numWarehouses;
50+
public static int useWarehouses;
51+
public static int useWarehouseFrom;
52+
public static int useWarehouseTo;
5053
public static int numMonkeys;
5154
public static int numSUTThreads;
5255
public static int maxDeliveryBGThreads;
@@ -144,6 +147,16 @@ public jTPCC() throws FileNotFoundException {
144147

145148
log.info("main, ");
146149
numWarehouses = Integer.parseInt(getProp(ini, "warehouses"));
150+
useWarehouseFrom = Integer.parseInt(getProp(ini, "useWarehouseFrom", "-1"));
151+
useWarehouseTo = Integer.parseInt(getProp(ini, "useWarehouseTo", "-1"));
152+
useWarehouses = numWarehouses;
153+
if (useWarehouseFrom > 0 && useWarehouseTo > 0) {
154+
useWarehouses = useWarehouseTo - useWarehouseFrom + 1;
155+
} else {
156+
useWarehouseFrom = 1;
157+
useWarehouseTo = useWarehouses;
158+
}
159+
147160
numMonkeys = Integer.parseInt(getProp(ini, "monkeys"));
148161
numSUTThreads = Integer.parseInt(getProp(ini, "sutThreads"));
149162
maxDeliveryBGThreads = Integer.parseInt(getProp(ini, "maxDeliveryBGThreads"));
@@ -176,7 +189,7 @@ public jTPCC() throws FileNotFoundException {
176189
log.info("main, ");
177190

178191
sutThreadDelay = (rampupSUTMins * 60000) / numSUTThreads;
179-
terminalDelay = (rampupTerminalMins * 60000) / (numWarehouses * 10);
192+
terminalDelay = (rampupTerminalMins * 60000) / (useWarehouses * 10);
180193

181194
if (iDBType.equals("oracle"))
182195
dbType = jTPCCConfig.DB_ORACLE;
@@ -411,7 +424,7 @@ else if (iDBType.equals("babelfish"))
411424
log.info("main, C value for nURandCLast this run: {}", rnd.getNURandCLast());
412425
log.info("main, ");
413426

414-
terminal_data = new jTPCCTData[numWarehouses * 10];
427+
terminal_data = new jTPCCTData[useWarehouses * 10];
415428

416429
/* Create the scheduler. */
417430
scheduler = new jTPCCScheduler(this);
@@ -448,9 +461,9 @@ else if (iDBType.equals("babelfish"))
448461
* them back into the scheduler queue to the flow to the client threads performing the real DB
449462
* work.
450463
*/
451-
for (int t = 0; t < numWarehouses * 10; t++) {
464+
for (int t = 0; t < useWarehouses * 10; t++) {
452465
terminal_data[t] = new jTPCCTData();
453-
terminal_data[t].term_w_id = (t / 10) + 1;
466+
terminal_data[t].term_w_id = (t / 10) + useWarehouseFrom;
454467
terminal_data[t].term_d_id = (t % 10) + 1;
455468
terminal_data[t].trans_type = jTPCCTData.TT_NONE;
456469
terminal_data[t].trans_due = now + t * terminalDelay;
@@ -468,7 +481,7 @@ else if (iDBType.equals("babelfish"))
468481
this.scheduler.at(result_begin, jTPCCScheduler.SCHED_BEGIN, new jTPCCTData());
469482
this.scheduler.at(result_end, jTPCCScheduler.SCHED_END, new jTPCCTData());
470483
this.scheduler.at(result_end + 10000, jTPCCScheduler.SCHED_DONE, new jTPCCTData());
471-
this.scheduler.at(now + (numWarehouses * 10) * terminalDelay,
484+
this.scheduler.at(now + (useWarehouses * 10) * terminalDelay,
472485
jTPCCScheduler.SCHED_TERM_LAUNCH_DONE, new jTPCCTData());
473486
this.scheduler.at(now + numSUTThreads * sutThreadDelay, jTPCCScheduler.SCHED_SUT_LAUNCH_DONE,
474487
new jTPCCTData());

src/main/resources/sample.firebird.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ password=PWbmsql
1515

1616
# Scaling and timing configuration
1717
warehouses=50
18+
useWarehouseFrom=-1
19+
useWarehouseTo=-1
1820
loadWorkers=8
1921
monkeys=2
2022
sutThreads=16

src/main/resources/sample.mariadb.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ password=PWbmsql
1515

1616
# Scaling and timing configuration
1717
warehouses=50
18+
useWarehouseFrom=-1
19+
useWarehouseTo=-1
1820
loadWorkers=8
1921
monkeys=2
2022
sutThreads=16

src/main/resources/sample.oracle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ password=PWbmsql
1515

1616
# Scaling and timing configuration
1717
warehouses=50
18+
useWarehouseFrom=-1
19+
useWarehouseTo=-1
1820
loadWorkers=8
1921
monkeys=2
2022
sutThreads=16

src/main/resources/sample.postgresql.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ password=PWbmsql
1515

1616
# Scaling and timing configuration
1717
warehouses=50
18+
useWarehouseFrom=-1
19+
useWarehouseTo=-1
1820
loadWorkers=8
1921
monkeys=2
2022
sutThreads=16

src/main/resources/sample.transact-sql.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ password=PWbmsql
1515

1616
# Scaling and timing configuration
1717
warehouses=50
18+
useWarehouseFrom=-1
19+
useWarehouseTo=-1
1820
loadWorkers=8
1921
monkeys=2
2022
sutThreads=16

0 commit comments

Comments
 (0)