Sampling of Commit and Transaction

Description

Testing
This commit is contained in:
Bhawani Shankar Sharma 2020-07-01 01:56:51 +00:00
parent 3e9c4077a4
commit 03c3bd0d67
1 changed files with 44 additions and 31 deletions

View File

@ -254,15 +254,18 @@ int populate(FDBTransaction* transaction, mako_args_t* args, int worker_id, int
/* commit every 100 inserts (default) */
if (i % args->txnspec.ops[OP_INSERT][OP_COUNT] == 0) {
clock_gettime(CLOCK_MONOTONIC, &timer_start_commit);
if (stats->xacts % args->sampling == 0) clock_gettime(CLOCK_MONOTONIC, &timer_start_commit);
if (commit_transaction(transaction) != FDB_SUCCESS) goto failExit;
/* xact latency stats */
clock_gettime(CLOCK_MONOTONIC, &timer_per_xact_end);
update_op_lat_stats(&timer_start_commit, &timer_per_xact_end, OP_COMMIT, stats, block, elem_size,
is_memory_allocated);
update_op_lat_stats(&timer_per_xact_start, &timer_per_xact_end, OP_TRANSACTION, stats, block, elem_size,
is_memory_allocated);
if (stats->xacts % args->sampling == 0) {
clock_gettime(CLOCK_MONOTONIC, &timer_per_xact_end);
update_op_lat_stats(&timer_start_commit, &timer_per_xact_end, OP_COMMIT, stats, block, elem_size,
is_memory_allocated);
update_op_lat_stats(&timer_per_xact_start, &timer_per_xact_end, OP_TRANSACTION, stats, block, elem_size,
is_memory_allocated);
}
stats->ops[OP_COMMIT]++;
stats->ops[OP_TRANSACTION]++;
clock_gettime(CLOCK_MONOTONIC, &timer_per_xact_start);
@ -273,15 +276,17 @@ int populate(FDBTransaction* transaction, mako_args_t* args, int worker_id, int
}
}
clock_gettime(CLOCK_MONOTONIC, &timer_start_commit);
if (stats->xacts % args->sampling == 0) clock_gettime(CLOCK_MONOTONIC, &timer_start_commit);
if (commit_transaction(transaction) != FDB_SUCCESS) goto failExit;
/* xact latency stats */
clock_gettime(CLOCK_MONOTONIC, &timer_per_xact_end);
update_op_lat_stats(&timer_start_commit, &timer_per_xact_end, OP_COMMIT, stats, block, elem_size,
is_memory_allocated);
update_op_lat_stats(&timer_per_xact_start, &timer_per_xact_end, OP_TRANSACTION, stats, block, elem_size,
is_memory_allocated);
if (stats->xacts % args->sampling == 0) {
clock_gettime(CLOCK_MONOTONIC, &timer_per_xact_end);
update_op_lat_stats(&timer_start_commit, &timer_per_xact_end, OP_COMMIT, stats, block, elem_size,
is_memory_allocated);
update_op_lat_stats(&timer_per_xact_start, &timer_per_xact_end, OP_TRANSACTION, stats, block, elem_size,
is_memory_allocated);
}
clock_gettime(CLOCK_MONOTONIC, &timer_end);
stats->xacts++;
@ -519,16 +524,18 @@ retryTxn:
if (rc == FDB_SUCCESS) {
/* commit insert so mutation goes to storage */
/* to measure commit latency */
clock_gettime(CLOCK_MONOTONIC, &timer_start_commit);
if (stats->xacts % args->sampling == 0) clock_gettime(CLOCK_MONOTONIC, &timer_start_commit);
rc = commit_transaction(transaction);
if (rc == FDB_SUCCESS) {
clock_gettime(CLOCK_MONOTONIC, &timer_per_xact_end);
stats->ops[OP_COMMIT]++;
stats->ops[OP_TRANSACTION]++;
update_op_lat_stats(&timer_start_commit, &timer_per_xact_end, OP_COMMIT, stats, block,
elem_size, is_memory_allocated);
update_op_lat_stats(&timer_per_xact_start, &timer_per_xact_end, OP_TRANSACTION, stats,
block, elem_size, is_memory_allocated);
if (stats->xacts % args->sampling == 0) {
clock_gettime(CLOCK_MONOTONIC, &timer_per_xact_end);
update_op_lat_stats(&timer_start_commit, &timer_per_xact_end, OP_COMMIT, stats, block,
elem_size, is_memory_allocated);
update_op_lat_stats(&timer_per_xact_start, &timer_per_xact_end, OP_TRANSACTION, stats,
block, elem_size, is_memory_allocated);
}
} else {
/* error */
if (rc == FDB_ERROR_CONFLICT) {
@ -574,16 +581,18 @@ retryTxn:
}
}
/* commit insert so mutation goes to storage */
clock_gettime(CLOCK_MONOTONIC, &timer_start_commit);
if (stats->xacts % args->sampling == 0) clock_gettime(CLOCK_MONOTONIC, &timer_start_commit);
rc = commit_transaction(transaction);
if (rc == FDB_SUCCESS) {
stats->ops[OP_COMMIT]++;
stats->ops[OP_TRANSACTION]++;
clock_gettime(CLOCK_MONOTONIC, &timer_per_xact_end);
update_op_lat_stats(&timer_start_commit, &timer_per_xact_end, OP_COMMIT, stats, block,
elem_size, is_memory_allocated);
update_op_lat_stats(&timer_per_xact_start, &timer_per_xact_end, OP_TRANSACTION, stats, block,
elem_size, is_memory_allocated);
if (stats->xacts % args->sampling == 0) {
clock_gettime(CLOCK_MONOTONIC, &timer_per_xact_end);
update_op_lat_stats(&timer_start_commit, &timer_per_xact_end, OP_COMMIT, stats, block,
elem_size, is_memory_allocated);
update_op_lat_stats(&timer_per_xact_start, &timer_per_xact_end, OP_TRANSACTION, stats,
block, elem_size, is_memory_allocated);
}
} else {
/* error */
if (rc == FDB_ERROR_CONFLICT) {
@ -638,14 +647,16 @@ retryTxn:
/* commit only successful transaction */
if (docommit | args->commit_get) {
clock_gettime(CLOCK_MONOTONIC, &timer_start_commit);
if (stats->xacts % args->sampling == 0) clock_gettime(CLOCK_MONOTONIC, &timer_start_commit);
rc = commit_transaction(transaction);
if (rc == FDB_SUCCESS) {
/* success */
stats->ops[OP_COMMIT]++;
clock_gettime(CLOCK_MONOTONIC, &timer_per_xact_end);
update_op_lat_stats(&timer_start_commit, &timer_per_xact_end, OP_COMMIT, stats, block, elem_size,
is_memory_allocated);
if (stats->xacts % args->sampling == 0) {
clock_gettime(CLOCK_MONOTONIC, &timer_per_xact_end);
update_op_lat_stats(&timer_start_commit, &timer_per_xact_end, OP_COMMIT, stats, block, elem_size,
is_memory_allocated);
}
} else {
/* error */
if (rc == FDB_ERROR_CONFLICT) {
@ -662,10 +673,12 @@ retryTxn:
}
}
clock_gettime(CLOCK_MONOTONIC, &timer_per_xact_end);
stats->ops[OP_TRANSACTION]++;
update_op_lat_stats(&timer_per_xact_start, &timer_per_xact_end, OP_TRANSACTION, stats, block, elem_size,
is_memory_allocated);
if (stats->xacts % args->sampling == 0) {
clock_gettime(CLOCK_MONOTONIC, &timer_per_xact_end);
update_op_lat_stats(&timer_per_xact_start, &timer_per_xact_end, OP_TRANSACTION, stats, block, elem_size,
is_memory_allocated);
}
stats->xacts++;