Skip to content

Commit

Permalink
Merge pull request #13203 from ifed01/wip-bluestore-more-dump
Browse files Browse the repository at this point in the history
os: extend ObjectStore interface to dump store's performance counters

Reviewed-by: Sage Weil <sage@redhat.com>
  • Loading branch information
liewegas committed Feb 1, 2017
2 parents 13a52e9 + 9ee28c3 commit 09d23e8
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/os/ObjectStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -1502,6 +1502,7 @@ class ObjectStore {

virtual void get_db_statistics(Formatter *f) { }
virtual void generate_db_histogram(Formatter *f) { }
virtual void dump_perf_counters(Formatter *f) {}

virtual string get_type() = 0;

Expand Down
10 changes: 7 additions & 3 deletions src/os/bluestore/BlueStore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2875,6 +2875,8 @@ void BlueStore::_init_logger()
"Average finishing state latency");
b.add_time_avg(l_bluestore_state_done_lat, "state_done_lat",
"Average done state latency");
b.add_time_avg(l_bluestore_submit_lat, "submit_lat",
"Average submit latency");
b.add_time_avg(l_bluestore_commit_lat, "commit_lat",
"Average commit latency");
b.add_time_avg(l_bluestore_compress_lat, "compress_lat",
Expand Down Expand Up @@ -2927,9 +2929,9 @@ void BlueStore::_init_logger()

b.add_u64(l_bluestore_write_big, "bluestore_write_big",
"Large min_alloc_size-aligned writes into fresh blobs");
b.add_u64(l_bluestore_write_big_bytes, "bleustore_write_big_bytes",
b.add_u64(l_bluestore_write_big_bytes, "bluestore_write_big_bytes",
"Large min_alloc_size-aligned writes into fresh blobs (bytes)");
b.add_u64(l_bluestore_write_big_blobs, "bleustore_write_big_blobs",
b.add_u64(l_bluestore_write_big_blobs, "bluestore_write_big_blobs",
"Large min_alloc_size-aligned writes into fresh blobs (blobs)");
b.add_u64(l_bluestore_write_small, "bluestore_write_small",
"Small writes into existing or sparse small blobs");
Expand Down Expand Up @@ -7185,7 +7187,7 @@ int BlueStore::queue_transactions(
delete onreadable_sync;
return 0;
}

utime_t start = ceph_clock_now();
// set up the sequencer
OpSequencer *osr;
assert(posr);
Expand Down Expand Up @@ -7241,6 +7243,8 @@ int BlueStore::queue_transactions(

// execute (start)
_txc_state_proc(txc);

logger->tinc(l_bluestore_submit_lat, ceph_clock_now() - start);
return 0;
}

Expand Down
7 changes: 7 additions & 0 deletions src/os/bluestore/BlueStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "include/memory.h"
#include "include/mempool.h"
#include "common/Finisher.h"
#include "common/perf_counters.h"
#include "compressor/Compressor.h"
#include "os/ObjectStore.h"

Expand Down Expand Up @@ -61,6 +62,7 @@ enum {
l_bluestore_state_wal_cleanup_lat,
l_bluestore_state_finishing_lat,
l_bluestore_state_done_lat,
l_bluestore_submit_lat,
l_bluestore_commit_lat,
l_bluestore_compress_lat,
l_bluestore_decompress_lat,
Expand Down Expand Up @@ -1815,6 +1817,11 @@ class BlueStore : public ObjectStore,

void get_db_statistics(Formatter *f) override;
void generate_db_histogram(Formatter *f) override;
void dump_perf_counters(Formatter *f) override {
f->open_object_section("perf_counters");
logger->dump_formatted(f, false);
f->close_section();
}

public:
int statfs(struct store_statfs_t *buf) override;
Expand Down
6 changes: 6 additions & 0 deletions src/os/filestore/FileStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ using namespace std;

#include "common/Timer.h"
#include "common/WorkQueue.h"
#include "common/perf_counters.h"

#include "common/Mutex.h"
#include "HashIndex.h"
Expand Down Expand Up @@ -475,6 +476,11 @@ class FileStore : public JournalingObjectStore,
bool needs_journal() {
return false;
}
void dump_perf_counters(Formatter *f) override {
f->open_object_section("perf_counters");
logger->dump_formatted(f, false);
f->close_section();
}

int write_version_stamp();
int version_stamp_is_valid(uint32_t *version);
Expand Down
5 changes: 5 additions & 0 deletions src/os/kstore/KStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,11 @@ class KStore : public ObjectStore {
int mkjournal() {
return 0;
}
void dump_perf_counters(Formatter *f) override {
f->open_object_section("perf_counters");
logger->dump_formatted(f, false);
f->close_section();
}

int statfs(struct store_statfs_t *buf) override;

Expand Down
12 changes: 11 additions & 1 deletion src/test/fio/fio_ceph_objectstore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "include/assert.h" // fio.h clobbers our assert.h

#define dout_context g_ceph_context
#define dout_subsys ceph_subsys_

namespace {

Expand Down Expand Up @@ -83,7 +84,13 @@ struct Engine {
std::lock_guard<std::mutex> l(lock);
--ref_count;
if (!ref_count) {
ostringstream ostr;
Formatter* f = Formatter::create("json-pretty", "json-pretty", "json-pretty");
os->dump_perf_counters(f);
f->flush(ostr);
delete f;
os->umount();
dout(0) << "FIO plugin " << ostr.str() << dendl;
}
}
};
Expand Down Expand Up @@ -336,7 +343,10 @@ int fio_ceph_os_queue(thread_data* td, io_u* u)
// enqueue a write transaction on the collection's sequencer
ObjectStore::Transaction t;
t.write(coll.cid, object.oid, u->offset, u->xfer_buflen, bl, flags);
os->queue_transaction(&coll.sequencer, std::move(t), new UnitComplete(u));
os->queue_transaction(&coll.sequencer,
std::move(t),
nullptr,
new UnitComplete(u));
return FIO_Q_QUEUED;
}

Expand Down

0 comments on commit 09d23e8

Please sign in to comment.