mirror of
https://github.com/ceph/ceph
synced 2025-01-18 09:02:08 +00:00
ceph_test_keyvaluedb: add simple commit latency benchmark
Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
parent
05d79b66cf
commit
b7c5bd12b4
@ -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; i<n; ++i) {
|
||||
KeyValueDB::Transaction t = db->get_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,
|
||||
|
Loading…
Reference in New Issue
Block a user