Triton Repository branch, master, updated. 4493d84025240016fcba45f70263c48c10a0298d
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Triton Repository". The branch, master has been updated via 4493d84025240016fcba45f70263c48c10a0298d (commit) via 266e40246af839b91f5d0dc0c049f0c375e25f38 (commit) via 495bd35f7de150695bd28947c62fdd74a9868cc1 (commit) via 9c63c455a117c3f33c3b339e79551f6fa3b98156 (commit) via ddabd1a4f14af64f101c231a36fa268435a12e8a (commit) from 39184121d296857d6ae222bfb9aae0b2fa5aa4a9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4493d84025240016fcba45f70263c48c10a0298d Author: Phil Carns <[email protected]> Date: Mon Feb 21 17:27:13 2011 -0500 first cut at I/O benchmark in vosd_autotune commit 266e40246af839b91f5d0dc0c049f0c375e25f38 Author: Phil Carns <[email protected]> Date: Mon Feb 21 16:14:21 2011 -0500 change default bdb flush thread mode commit 495bd35f7de150695bd28947c62fdd74a9868cc1 Author: Phil Carns <[email protected]> Date: Mon Feb 21 16:09:23 2011 -0500 more autotuning, thread modes, and bug fixes commit 9c63c455a117c3f33c3b339e79551f6fa3b98156 Author: Phil Carns <[email protected]> Date: Mon Feb 21 14:52:23 2011 -0500 first steps in vosd autotuning (create/rm bench) commit ddabd1a4f14af64f101c231a36fa268435a12e8a Author: Phil Carns <[email protected]> Date: Mon Feb 21 14:49:09 2011 -0500 change default txn progress mode ----------------------------------------------------------------------- Summary of changes: code/src/common/triton-hash.h | 2 +- .../prototype/bdb-resource/bdb-resource.c | 18 ++- code/src/versioned-osd/prototype/versioned-osd.ae | 266 ++++++++++++++++++-- 3 files changed, 261 insertions(+), 25 deletions(-) Diff of changes: diff --git a/code/src/common/triton-hash.h b/code/src/common/triton-hash.h index f8a8feb..69db9f2 100644 --- a/code/src/common/triton-hash.h +++ b/code/src/common/triton-hash.h @@ -376,7 +376,7 @@ static inline int triton_hash_string_hash(const void *k, int table_size) static inline int triton_hash_ptr_hash(const void *k, int table_size) { uint32_t pc = 0, pb = 0; - bj_hashlittle2(k, sizeof(k), &pc, &pb); + bj_hashlittle2(&k, sizeof(k), &pc, &pb); return pc & (table_size - 1); } diff --git a/code/src/versioned-osd/prototype/bdb-resource/bdb-resource.c b/code/src/versioned-osd/prototype/bdb-resource/bdb-resource.c index a4f4e45..b816e9e 100644 --- a/code/src/versioned-osd/prototype/bdb-resource/bdb-resource.c +++ b/code/src/versioned-osd/prototype/bdb-resource/bdb-resource.c @@ -293,6 +293,13 @@ static triton_ret_t bdb_launch_op(struct ae_op *op, enum bdb_progress_mode mode, break; case TRITON_BDB_PROG_THREAD_PER_TXN: triton_mutex_lock(&bdb_mutex); + if(txn == NULL) + { + /* if no txn, then set pointer to 1 to avoid safety checks + * in triton_hash + */ + txn = (DB_TXN*)1; + } tmp_link = triton_hash_search(txn_thread_table, txn); if(!tmp_link) { @@ -428,7 +435,7 @@ triton_ret_t bdb_init(void) } ret = triton_zeroconf_register(txn_progress_mode_confkey, - "THREAD_PER_OP", progress_mode_updater, + "THREAD_PER_TXN", progress_mode_updater, "Progress mode for BDB transactions (THREAD_PER_OP or THREAD_PER_TXN"); if(ret != TRITON_SUCCESS && ret != TRITON_ERR_EXIST) { @@ -436,8 +443,8 @@ triton_ret_t bdb_init(void) } ret = triton_zeroconf_register(flush_progress_mode_confkey, - "THREAD_PER_OP", progress_mode_updater, - "Progress mode for flushing BDB data (IN_PLACE, POLL, or THREAD_PER_OP"); + "ONE_THREAD", progress_mode_updater, + "Progress mode for flushing BDB data (IN_PLACE, POLL, THREAD_PER_OP, or ONE_THREAD"); if(ret != TRITON_SUCCESS && ret != TRITON_ERR_EXIST) { return(ret); @@ -1085,6 +1092,9 @@ static triton_ret_t progress_mode_updater(const char *key, const char *value) else return(TRITON_ERR_INVAL); } + /* NOTE: ONE_THREAD mode for flush operations gets translated into + * THREAD_PER_TXN on a NULL txn + */ else if(!strcmp(key, flush_progress_mode_confkey)) { if(!strcmp(value, "IN_PLACE")) @@ -1093,6 +1103,8 @@ static triton_ret_t progress_mode_updater(const char *key, const char *value) flush_progress_mode = TRITON_BDB_PROG_POLL; else if(!strcmp(value, "THREAD_PER_OP")) flush_progress_mode = TRITON_BDB_PROG_THREAD_PER_OP; + else if(!strcmp(value, "ONE_THREAD")) + flush_progress_mode = TRITON_BDB_PROG_THREAD_PER_TXN; else return(TRITON_ERR_INVAL); } diff --git a/code/src/versioned-osd/prototype/versioned-osd.ae b/code/src/versioned-osd/prototype/versioned-osd.ae index 6b29350..94eefdc 100644 --- a/code/src/versioned-osd/prototype/versioned-osd.ae +++ b/code/src/versioned-osd/prototype/versioned-osd.ae @@ -16,6 +16,7 @@ #include "src/common/triton-base.h" #include "src/aesop/aesop.h" #include "src/common/triton-hash.h" +#include "src/common/resources/timer/timer.hae" #include "src/versioned-osd/prototype/bdb-resource/bdb-resource.hae" #include "src/versioned-osd/prototype/file-resource/file-resource.hae" #include "src/versioned-osd/prototype/versioned-osd.hae" @@ -1739,7 +1740,7 @@ void vosd_finalize(void) __attribute__((constructor)) void triton_vosd_init_register(void) { triton_init_register("triton.vosd", vosd_init, vosd_finalize, NULL, - "triton.resource.sched", "triton.vosd.bdb", "triton.vosd.file"); + "triton.resource.sched", "triton.vosd.bdb", "triton.vosd.file", "triton.resource.timer"); } #if 0 @@ -3381,6 +3382,30 @@ __blocking triton_ret_t vosd_check_niid(uint128_t oid, uint64_t niid, int op_typ return(tret); } +static __blocking triton_ret_t purge_niids_from_oid(uint64_t max, uint128_t oid) +{ + int i; + uint64_t niid; + triton_ret_t tret; + + for(i=1; i<=max; i++) + { + niid = i; + tret = vosd_discard_niids(&oid, &niid, 1); + /* TODO: why am I getting ENOENT on an niid here? */ + if(tret != TRITON_ERR_NOENT) + { + triton_error_assert(tret); + } + else + { + printf("Warning: hit ENOENT when purging niid: %llu\n", niid); + } + } + + return(TRITON_SUCCESS); +} + static __blocking triton_ret_t purge_niids(uint64_t max) { int i; @@ -3407,14 +3432,15 @@ static __blocking triton_ret_t purge_niids(uint64_t max) return(TRITON_SUCCESS); } -static __blocking triton_ret_t create_rm_bench(double seconds, double* ops_per_sec) +static __blocking triton_ret_t create_rm_bench(double seconds, + int concurrency, double* ops_per_sec) { - int concurrent = 32; int started = 0; triton_mutex_t started_mutex; double start_tm; double end_tm; double now; + triton_ret_t tret; triton_mutex_init(&started_mutex, NULL); @@ -3430,7 +3456,7 @@ static __blocking triton_ret_t create_rm_bench(double seconds, double* ops_per_s done = 0; started = 0; - for(i=0; i<concurrent; i++) + for(i=0; i<concurrency; i++) { pbranch { @@ -3470,49 +3496,247 @@ static __blocking triton_ret_t create_rm_bench(double seconds, double* ops_per_s /* get rid of any niids that were inserted by the benchmark */ purge_niids(started); + /* make sure that the txn log is flushed */ + tret = bdb_txn_checkpoint(envp, 0, 0, 0); + + return(TRITON_SUCCESS); +} + +static __blocking triton_ret_t write_bench(double seconds, + int concurrency, int op_size, double* ops_per_sec) +{ + int started = 0; + triton_mutex_t started_mutex; + double start_tm; + double end_tm; + double now; + triton_ret_t tret; + uint128_t oid; + int64_t offset = 0; + char* buffer; + int64_t buffer_size = op_size; + + buffer = malloc(op_size); + if(!buffer) + { + return(TRITON_ERR_NOMEM); + } + + oid = triton_uint128_from_uint64(0); + tret = vosd_create(oid, 0); + triton_error_assert(tret); + + triton_mutex_init(&started_mutex, NULL); + + start_tm = Wtime(); + pwait + { + pprivate int i; + pprivate triton_ret_t b_ret; + pprivate double now; + pprivate int done = 0; + pprivate uint64_t niid; + + done = 0; + started = 0; + for(i=0; i<concurrency; i++) + { + pbranch + { + while(!done) + { + triton_mutex_lock(&started_mutex); + now = Wtime(); + if(now - start_tm > seconds) + { + done = 1; + } + else + { + started++; + niid = started; + offset = i*op_size; + } + triton_mutex_unlock(&started_mutex); + + if(!done) + { + /* NOTE: using niid as txn number here */ + b_ret = vosd_write(oid, 0, niid, &buffer, &buffer_size, 1, &offset, &buffer_size, 1, VOSD_FLAG_AUTO_TXN, niid); + triton_error_assert(b_ret); + } + } + } + } + } + end_tm = Wtime(); + + *ops_per_sec = (double)started/(end_tm-start_tm); + + triton_mutex_destroy(&started_mutex); + + tret = vosd_remove(oid, 0); + triton_error_assert(tret); + + /* get rid of any niids that were inserted by the benchmark */ + purge_niids_from_oid(started, oid); + + /* make sure that the txn log is flushed */ + tret = bdb_txn_checkpoint(envp, 0, 0, 0); + + free(buffer); return(TRITON_SUCCESS); } + __blocking triton_ret_t vosd_autotune(void) { triton_ret_t tret; - double ops_per_sec; - double duration = 5.0; /* TODO: make this bigger */ + double ops_warmup, ops_thread_txn, ops_thread_op, ops_flush_thread_per_op; + double wr_warmup, wr1_default, wr1_no_threads, wr1_no_odirect; + double wr2_default, wr2_no_threads, wr2_no_odirect; + double duration = 20.0; + int concurrency = 32; + const char* value; + + /* check default settings; we want to have defaults when we start */ + value = triton_zeroconf_get( + "triton.bdb.txn_progress_mode"); + if(strcmp(value, "THREAD_PER_TXN") != 0) + { + fprintf(stderr, "Error: bdb not in default txn_progress_mode of THREAD_PER_TXN.\n"); + return(TRITON_ERR_INVAL); + } + + value = triton_zeroconf_get( + "triton.bdb.flush_progress_mode"); + if(strcmp(value, "ONE_THREAD") != 0) + { + fprintf(stderr, "Error: bdb not in default flush_progress_mode of THREAD_PER_OP.\n"); + return(TRITON_ERR_INVAL); + } + + value = triton_zeroconf_get( + "triton.file.io_progress_mode"); + if(strcmp(value, "THREAD_PER_OP") != 0) + { + fprintf(stderr, "Error: file not in default io_progress_mode of THREAD_PER_OP.\n"); + return(TRITON_ERR_INVAL); + } - /* benchmark with thread-per-txn */ + if(!(global_flags & VOSD_INIT_FLAG_DATA_ODIRECT)) + { + fprintf(stderr, "Error: VOSD not using default DATA_ODIRECT flag.\n"); + return(TRITON_ERR_INVAL); + } + + + printf("vosd_autotune: concurrent operations %d\n", concurrency); + printf("vosd_autotune: duration of each test: %f\n", duration); + printf("vosd_autotune: confirmed default settings:\n"); + printf(" bdb txns: THREAD_PER_TXN\n"); + printf(" bdb flushes: ONE_THREAD.\n"); + printf(" io: THREAD_PER_OP\n"); + printf(" io flags: O_DIRECT\n"); + + /* warm up run before real testing */ + printf("vosd_autotune: metadata warm up run...\n"); + tret = create_rm_bench(duration, concurrency, &ops_warmup); + triton_error_assert(tret); + printf("vosd_autotune: warm up done.\n"); + + triton_timer(1000); + + /* real test */ + printf("vosd_autotune: bdb: default settings ...\n"); + tret = create_rm_bench(duration, concurrency, &ops_thread_txn); + triton_error_assert(tret); + printf(" %f (creates+removes)/sec\n", ops_thread_txn); + + triton_timer(1000); + + /* switch to thread per op mode */ tret = triton_zeroconf_set( - "triton.bdb.txn_progress_mode", "THREAD_PER_TXN"); + "triton.bdb.txn_progress_mode", "THREAD_PER_OP"); triton_error_assert(tret); + + printf("vosd_autotune: bdb txns: THREAD_PER_OP ...\n"); + tret = create_rm_bench(duration, concurrency, &ops_thread_op); + triton_error_assert(tret); + printf(" %f (creates+removes)/sec\n", ops_thread_op); + + triton_timer(1000); + + if(ops_thread_op < ops_thread_txn) + { + printf(" keeping default setting.\n"); + tret = triton_zeroconf_set( + "triton.bdb.txn_progress_mode", "THREAD_PER_TXN"); + triton_error_assert(tret); + } + else + { + printf(" using bdb txn mode THREAD_PER_OP for subsequent tests.\n"); + } + + /* switch to thread_per_op for flushes */ tret = triton_zeroconf_set( "triton.bdb.flush_progress_mode", "THREAD_PER_OP"); triton_error_assert(tret); - /* TODO: warm up run before real testing */ + printf("vosd_autotune: bdb flushes: THREAD_PER_OP ...\n"); + tret = create_rm_bench(duration, concurrency, &ops_flush_thread_per_op); + triton_error_assert(tret); + printf(" %f (creates+removes)/sec\n", ops_flush_thread_per_op); + + triton_timer(1000); - tret = create_rm_bench(10, &ops_per_sec); + if(ops_flush_thread_per_op > ops_thread_op && ops_flush_thread_per_op > ops_thread_txn) + { + printf(" Using bdb flush mode THREAD_PER_OP for subsequent tests.\n"); + } + else + { + printf(" keeping default setting.\n"); + tret = triton_zeroconf_set( + "triton.bdb.flush_progress_mode", "ONE_THREAD"); + triton_error_assert(tret); + } + + printf("vosd_autotune: write warm up run...\n"); + tret = write_bench(duration, concurrency, 4*1024*1024, &wr_warmup); + triton_error_assert(tret); + printf("vosd_autotune: warm up done.\n"); + + triton_timer(1000); + + printf("vosd_autotune: 4KiB writes ...\n"); + tret = write_bench(duration, concurrency, 4*1024, &wr1_default); + triton_error_assert(tret); + printf(" %f (4KiB writes)/sec\n", wr1_default); + + triton_timer(1000); + + printf("vosd_autotune: 4MiB writes ...\n"); + tret = write_bench(duration, concurrency, 4*1024*1024, &wr2_default); + triton_error_assert(tret); + printf(" %f (4MiB writes)/sec\n", wr2_default); + + triton_timer(1000); - printf("BDB thread_per_txn create+remove rate: %f ops/sec\n", ops_per_sec); /* things to test: * - * - vosd_create() with niids enabled and vosd_discard_niids(), - * stresses bdb write txn performance - * - toggle the txn_progress_mode - * - sweep across coalescing values? - * * - using results from above, do: * * - vosd_write small (4k read) * - with and without o_direct * - with and without threads - * - sweep coalescing values again? * - vosd_write large (4M read) * - with and without o_direct * - with and without threads - * - sweep coalescing values again? * - * - run everything in parallel; we don't really care so much about - * sequential performance - * - maybe do test duration based on elapsed time rather than number of ops? + * - thread pool model for file resource? + * - sweep across coalescing values? * - hold alignment fixed at 4096 for now * */ hooks/post-receive -- Triton Repository
participants (1)
-
noreply@mcs.anl.gov