From 257b5587caba568dd72fb5237e765beab1e6f6fb Mon Sep 17 00:00:00 2001 From: sears Date: Tue, 23 Aug 2011 01:26:05 +0000 Subject: [PATCH] create new executable, lsm_microbenchmarks. The idea is to bring up the LSM tree a little at a time, and see where the performance falls over. git-svn-id: svn+ssh://svn.corp.yahoo.com/yahoo/yrl/labs/pnuts/code/logstore@2940 8dad8b1f-cf64-0410-95b6-bcf113ffbcfe --- benchmarks/CMakeLists.txt | 1 + benchmarks/lsm_microbenchmarks.cpp | 66 ++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 benchmarks/lsm_microbenchmarks.cpp diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index 83a25e8..714a314 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -1 +1,2 @@ CREATE_CLIENT_EXECUTABLE(tcpclient_noop) +CREATE_EXECUTABLE(lsm_microbenchmarks) \ No newline at end of file diff --git a/benchmarks/lsm_microbenchmarks.cpp b/benchmarks/lsm_microbenchmarks.cpp new file mode 100644 index 0000000..fea6fb7 --- /dev/null +++ b/benchmarks/lsm_microbenchmarks.cpp @@ -0,0 +1,66 @@ +/* + * lsm_microbenchmarks.cpp + * + * Created on: Aug 22, 2011 + * Author: sears + */ +#include +#include +#include +#include +#include + +BEGIN_C_DECLS + +int main(int argc, char * argv[]); + +END_C_DECLS + +enum run_type { + ALL = 0 +}; + +int main (int argc, char * argv[]) { + uint64_t mb = 10000; // size of run, in bytes. + enum run_type mode = ALL; + + const uint64_t num_pages = mb * ((1024 * 1024) / PAGE_SIZE); + + logtable::init_stasis(); + + if(!mode) { + int xid = Tbegin(); + printf("Starting first write of %lld mb\n", (long long)mb); + struct timeval start, stop; double elapsed; + gettimeofday(&start, 0); + for(uint64_t i = 0; i < num_pages; i++) { + Page * p = loadUninitializedPage(xid, i); + stasis_dirty_page_table_set_dirty((stasis_dirty_page_table_t*)stasis_runtime_dirty_page_table(), p); + releasePage(p); + } + gettimeofday(&stop, 0); + elapsed = stasis_timeval_to_double(stasis_subtract_timeval(stop, start)); + printf("Write (unforced) took %f seconds (%f mb/sec)\n", elapsed, ((double)mb)/elapsed); + printf("Starting write of giant datapage\n"); + gettimeofday(&start, 0); + RegionAllocator * alloc = new RegionAllocator(xid, num_pages); + DataPage * dp = new DataPage(xid, 10000, alloc); + byte * key = (byte*)calloc(100, 1); + byte * val = (byte*)calloc(900, 1); + datatuple * tup = datatuple::create(key, 100, val, 900); + free(key); + free(val); + while(1) { + if(!dp->append(tup)) { + break; + } + } + alloc->force_regions(xid); + Tcommit(xid); + gettimeofday(&stop, 0); + elapsed = stasis_timeval_to_double(stasis_subtract_timeval(stop, start)); + printf("Write (forced) took %f seconds (%f mb/sec)\n", elapsed, ((double)mb)/elapsed); + } + + logtable::deinit_stasis(); +}