summaryrefslogtreecommitdiff
path: root/bench
diff options
context:
space:
mode:
authorAlex Gorrod <alexg@wiredtiger.com>2014-10-22 11:03:20 +1100
committerAlex Gorrod <alexg@wiredtiger.com>2014-10-22 11:03:20 +1100
commit85266149f824e7ffc74d73367af43fcc86242f4f (patch)
treeac45a261920497280aaab3d2496bb6dfa69d8067 /bench
parent2de63b885fc36d50d1770586983d79e59030b419 (diff)
downloadmongo-85266149f824e7ffc74d73367af43fcc86242f4f.tar.gz
Add the code changes tfor wtperf ops_per_txn.
Diffstat (limited to 'bench')
-rw-r--r--bench/wtperf/config.c5
-rw-r--r--bench/wtperf/wtperf.c26
-rw-r--r--bench/wtperf/wtperf.h2
-rw-r--r--bench/wtperf/wtperf_opt.i7
4 files changed, 38 insertions, 2 deletions
diff --git a/bench/wtperf/config.c b/bench/wtperf/config.c
index 3941a1b3d33..31b20621eea 100644
--- a/bench/wtperf/config.c
+++ b/bench/wtperf/config.c
@@ -224,6 +224,11 @@ config_threads(CONFIG *cfg, const char *config, size_t len)
goto err;
continue;
}
+ if (STRING_MATCH("ops_per_txn", k.str, k.len)) {
+ if ((workp->ops_per_txn = v.val) < 0)
+ goto err;
+ continue;
+ }
if (STRING_MATCH("read", k.str, k.len) ||
STRING_MATCH("reads", k.str, k.len)) {
if ((workp->read = v.val) < 0)
diff --git a/bench/wtperf/wtperf.c b/bench/wtperf/wtperf.c
index 3d04da78aa5..b8776497a17 100644
--- a/bench/wtperf/wtperf.c
+++ b/bench/wtperf/wtperf.c
@@ -381,7 +381,7 @@ worker(void *arg)
WT_CONNECTION *conn;
WT_CURSOR **cursors, *cursor;
WT_SESSION *session;
- int64_t throttle_ops;
+ int64_t ops, ops_per_txn, throttle_ops;
size_t i;
uint64_t next_val, usecs;
uint8_t *op, *op_end;
@@ -395,6 +395,8 @@ worker(void *arg)
session = NULL;
trk = NULL;
throttle_ops = 0;
+ ops = 0;
+ ops_per_txn = thread->workload->ops_per_txn;
if ((ret = conn->open_session(
conn, NULL, cfg->sess_config, &session)) != 0) {
@@ -429,6 +431,12 @@ worker(void *arg)
op = thread->workload->ops;
op_end = op + sizeof(thread->workload->ops);
+ if (ops_per_txn != 0 &&
+ (ret = session->begin_transaction(session, NULL)) != 0) {
+ lprintf(cfg, ret, 0, "First transaction begin failed");
+ goto err;
+ }
+
while (!cfg->stop) {
/*
* Generate the next key and setup operation specific
@@ -589,6 +597,22 @@ op_err: lprintf(cfg, ret, 0,
++trk->ops;
}
+ /* Commit our work if configured for explicit transactions */
+ if (ops_per_txn != 0 && ops++ % ops_per_txn == 0) {
+ if ((ret = session->commit_transaction(
+ session, NULL)) != 0) {
+ lprintf(cfg, ret, 0,
+ "Worker transaction commit failed");
+ goto err;
+ }
+ if ((ret = session->begin_transaction(
+ session, NULL)) != 0) {
+ lprintf(cfg, ret, 0,
+ "Worker transaction commit failed");
+ goto err;
+ }
+ }
+
/* Schedule the next operation */
if (++op == op_end)
op = thread->workload->ops;
diff --git a/bench/wtperf/wtperf.h b/bench/wtperf/wtperf.h
index dfd11b24955..cc70e76bd5d 100644
--- a/bench/wtperf/wtperf.h
+++ b/bench/wtperf/wtperf.h
@@ -84,6 +84,8 @@ typedef struct {
int64_t read; /* Read ratio */
int64_t update; /* Update ratio */
int64_t throttle; /* Maximum operations/second */
+ /* Number of operations per transaction. Zero for autocommit */
+ int64_t ops_per_txn;
#define WORKER_INSERT 1 /* Insert */
#define WORKER_INSERT_RMW 2 /* Insert with read-modify-write */
diff --git a/bench/wtperf/wtperf_opt.i b/bench/wtperf/wtperf_opt.i
index 606297eb438..c04f0f214f6 100644
--- a/bench/wtperf/wtperf_opt.i
+++ b/bench/wtperf/wtperf_opt.i
@@ -136,6 +136,10 @@ DEF_OPT_AS_UINT32(sample_interval, 0,
DEF_OPT_AS_UINT32(sample_rate, 50,
"how often the latency of operations is measured. One for every operation,"
"two for every second operation, three for every third operation etc.")
+DEF_OPT_AS_STRING(schema_threads, "", "Sometimes it's interesting to have "
+ "tables being created and removed in parallel with other operations. "
+ "Valid options for the schema_workload setting are: create, populate, "
+ "rollback")
DEF_OPT_AS_CONFIG_STRING(sess_config, "", "session configuration string")
DEF_OPT_AS_CONFIG_STRING(table_config,
"key_format=S,value_format=S,type=lsm,exclusive=true,"
@@ -155,7 +159,8 @@ DEF_OPT_AS_STRING(threads, "", "workload configuration: each 'count' "
"'threads=((count=2,reads=1)(count=8,reads=1,inserts=2,updates=1))' "
"which would create 2 threads doing nothing but reads and 8 threads "
"each doing 50% inserts and 25% reads and updates. Allowed configuration "
- "values are 'count', 'throttle', 'reads', 'inserts', 'updates'")
+ "values are 'count', 'throttle', 'reads', 'inserts', 'updates'. There are "
+ "also behavior modifiers, supported modifiers are 'ops_per_txn'")
DEF_OPT_AS_CONFIG_STRING(transaction_config, "",
"transaction configuration string, relevant when populate_opts_per_txn "
"is nonzero")