Skip to content

Commit

Permalink
chore: make sure workloadb benchmark runs properly (#349)
Browse files Browse the repository at this point in the history
  • Loading branch information
callmehiphop authored and JustinBeckwith committed Oct 1, 2018
1 parent 91f11f5 commit 3772a7a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
7 changes: 3 additions & 4 deletions benchmark/workload.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,9 @@ class Workload {
const field = `field${random(9)}`;
const value = crypto.randomBytes(100).toString('hex');

return this.database.getTransaction().then(data => {
const txn = data[0];
txn.update(tableName, {id, [field]: value});
return txn.commit();
return this.database.runTransactionAsync(transaction => {
transaction.update(tableName, {id, [field]: value});
return transaction.commit();
});
}
}
Expand Down
4 changes: 4 additions & 0 deletions benchmark/workloadb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
readproportion=0.5
updateproportion=0.5
scanproportion=0
insertproportion=0
4 changes: 2 additions & 2 deletions benchmark/ycsb.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const fs = require('fs');
const path = require('path');
const stats = require('stats-lite');

const Spanner = require('../src');
const {Spanner} = require('../');
const Workload = require('./workload');

require('yargs')
Expand Down Expand Up @@ -80,7 +80,7 @@ function printMetrics(workload) {

console.log(
dedent`[OVERALL], RunTime(ms), ${workload.duration}
[OVERALL], Throughput(ops/sec), ${totalOps / workload.duration}`
[OVERALL], Throughput(ops/sec), ${totalOps / (workload.duration / 1000)}`
);

workload.operations.forEach(operation => {
Expand Down

0 comments on commit 3772a7a

Please sign in to comment.