]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: add perf variable for throttle info in bluestore 12583/head
authorPan Liu <pan.liu@istuary.com>
Wed, 21 Dec 2016 02:28:26 +0000 (10:28 +0800)
committerPan Liu <pan.liu@istuary.com>
Wed, 21 Dec 2016 02:28:26 +0000 (10:28 +0800)
Signed-off-by: Pan Liu <pan.liu@istuary.com>
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h

index 13b80e1e3afaa14ec3cc427f9602b55fca5c48f0..eb1d273e544dbe6a2d76d8c8a1ee336ed69a5af8 100644 (file)
@@ -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;
index 2b528a31db32277e1573e5ee7f6449002b3dd5c4..396fbe5e75be1a2ec597d17ff98362ca67a26857 100644 (file)
@@ -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) {