From: Sage Weil Date: Tue, 1 Sep 2015 17:14:03 +0000 (-0400) Subject: ceph_test_keyvaluedb: add simple commit latency benchmark X-Git-Tag: v9.1.0~242^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F5578%2Fhead;p=ceph.git ceph_test_keyvaluedb: add simple commit latency benchmark Signed-off-by: Sage Weil --- diff --git a/src/test/objectstore/test_kv.cc b/src/test/objectstore/test_kv.cc index 61007e3bf33..df3805b8d1d 100644 --- a/src/test/objectstore/test_kv.cc +++ b/src/test/objectstore/test_kv.cc @@ -113,6 +113,39 @@ TEST_P(KVTest, PutReopen) { fini(); } +TEST_P(KVTest, BenchCommit) { + int n = 1024; + ASSERT_EQ(0, db->create_and_open(cout)); + utime_t start = ceph_clock_now(NULL); + { + cout << "priming" << std::endl; + // prime + bufferlist big; + bufferptr bp(1048576); + bp.zero(); + big.append(bp); + for (int i=0; i<30; ++i) { + KeyValueDB::Transaction t = db->get_transaction(); + t->set("prefix", "big" + stringify(i), big); + db->submit_transaction_sync(t); + } + } + cout << "now doing small writes" << std::endl; + bufferlist data; + bufferptr bp(1024); + bp.zero(); + data.append(bp); + for (int i=0; iget_transaction(); + t->set("prefix", "key" + stringify(i), data); + db->submit_transaction_sync(t); + } + utime_t end = ceph_clock_now(NULL); + utime_t dur = end - start; + cout << n << " commits in " << dur << ", avg latency " << (dur / (double)n) + << std::endl; +} + INSTANTIATE_TEST_CASE_P( KeyValueDB,