From 3e40595f3cd8626cdceffa4a3a4efb088127f726 Mon Sep 17 00:00:00 2001 From: Pan Liu Date: Wed, 21 Dec 2016 10:28:26 +0800 Subject: [PATCH] os/bluestore: add perf variable for throttle info in bluestore Signed-off-by: Pan Liu --- src/os/bluestore/BlueStore.cc | 57 ++++++++++++++++++++++++++++++----- src/os/bluestore/BlueStore.h | 10 ++++++ 2 files changed, 59 insertions(+), 8 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 13b80e1e3af..eb1d273e544 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -2739,6 +2739,15 @@ void BlueStore::_init_logger() b.add_u64(l_bluestore_write_small_new, "bluestore_write_small_new", "Small write into new (sparse) blob"); + b.add_u64(l_bluestore_cur_ops_in_queue, "bluestore_cur_ops_in_queue", + "Current ops in queue"); + b.add_u64(l_bluestore_cur_bytes_in_queue, "bluestore_cur_bytes_in_queue", + "Current bytes in queue"); + b.add_u64(l_bluestore_cur_ops_in_wal_queue, "bluestore_cur_ops_in_wal_queue", + "Current wal ops in wal queue"); + b.add_u64(l_bluestore_cur_bytes_in_wal_queue, "l_bluestore_cur_bytes_in_wal_queue", + "Current wal bytes in wal queue"); + b.add_u64(l_bluestore_txc, "bluestore_txc", "Transactions committed"); b.add_u64(l_bluestore_onode_reshard, "bluestore_onode_reshard", "Onode extent map reshard events"); @@ -6469,8 +6478,7 @@ void BlueStore::_txc_finish_kv(TransContext *txc) txc->oncommits.pop_front(); } - throttle_ops.put(txc->ops); - throttle_bytes.put(txc->bytes); + op_queue_release_throttle(txc); } void BlueStore::BSPerfTracker::update_from_perfcounters( @@ -6508,8 +6516,7 @@ void BlueStore::_txc_finish(TransContext *txc) txc->removed_collections.pop_front(); } - throttle_wal_ops.put(txc->ops); - throttle_wal_bytes.put(txc->bytes); + op_queue_release_wal_throttle(txc); OpSequencerRef osr = txc->osr; { @@ -6954,10 +6961,8 @@ int BlueStore::queue_transactions( if (handle) handle->suspend_tp_timeout(); - throttle_ops.get(txc->ops); - throttle_bytes.get(txc->bytes); - throttle_wal_ops.get(txc->ops); - throttle_wal_bytes.get(txc->bytes); + op_queue_reserve_throttle(txc); + op_queue_reserve_wal_throttle(txc); if (handle) handle->reset_tp_timeout(); @@ -6969,6 +6974,42 @@ int BlueStore::queue_transactions( return 0; } +void BlueStore::op_queue_reserve_throttle(TransContext *txc) +{ + throttle_ops.get(txc->ops); + throttle_bytes.get(txc->bytes); + + logger->set(l_bluestore_cur_ops_in_queue, throttle_ops.get_current()); + logger->set(l_bluestore_cur_bytes_in_queue, throttle_bytes.get_current()); +} + +void BlueStore::op_queue_release_throttle(TransContext *txc) +{ + throttle_ops.put(txc->ops); + throttle_bytes.put(txc->bytes); + + logger->set(l_bluestore_cur_ops_in_queue, throttle_ops.get_current()); + logger->set(l_bluestore_cur_bytes_in_queue, throttle_bytes.get_current()); +} + +void BlueStore::op_queue_reserve_wal_throttle(TransContext *txc) +{ + throttle_wal_ops.get(txc->ops); + throttle_wal_bytes.get(txc->bytes); + + logger->set(l_bluestore_cur_ops_in_wal_queue, throttle_wal_ops.get_current()); + logger->set(l_bluestore_cur_bytes_in_wal_queue, throttle_wal_bytes.get_current()); +} + +void BlueStore::op_queue_release_wal_throttle(TransContext *txc) +{ + throttle_wal_ops.put(txc->ops); + throttle_wal_bytes.put(txc->bytes); + + logger->set(l_bluestore_cur_ops_in_wal_queue, throttle_wal_ops.get_current()); + logger->set(l_bluestore_cur_bytes_in_wal_queue, throttle_wal_bytes.get_current()); +} + void BlueStore::_txc_aio_submit(TransContext *txc) { dout(10) << __func__ << " txc " << txc << dendl; diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 2b528a31db3..396fbe5e75b 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -92,6 +92,12 @@ enum { l_bluestore_write_small_wal, l_bluestore_write_small_pre_read, l_bluestore_write_small_new, + + l_bluestore_cur_ops_in_queue, + l_bluestore_cur_bytes_in_queue, + l_bluestore_cur_ops_in_wal_queue, + l_bluestore_cur_bytes_in_wal_queue, + l_bluestore_txc, l_bluestore_onode_reshard, l_bluestore_blob_split, @@ -2175,6 +2181,10 @@ private: CollectionRef& d, unsigned bits, int rem); + void op_queue_reserve_throttle(TransContext *txc); + void op_queue_release_throttle(TransContext *txc); + void op_queue_reserve_wal_throttle(TransContext *txc); + void op_queue_release_wal_throttle(TransContext *txc); }; inline ostream& operator<<(ostream& out, const BlueStore::OpSequencer& s) { -- 2.39.5