From: Igor Fedotov Date: Wed, 6 Apr 2022 20:31:24 +0000 (+0300) Subject: os/bluestore: more omap-related perf counters X-Git-Tag: v18.0.0~820^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3c6a72171d8b31b52982e3d8f4fc8226fea5b250;p=ceph.git os/bluestore: more omap-related perf counters Signed-off-by: Igor Fedotov --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 2922c88adea5..962e5ffc169d 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -4297,7 +4297,7 @@ void *BlueStore::MempoolThread::entry() _resize_shards(interval_stats_trim); interval_stats_trim = false; - store->_update_cache_logger(); + store->_update_logger(); auto wait = ceph::make_timespan( store->cct->_conf->bluestore_cache_trim_interval); cond.wait_for(l, wait); @@ -4412,9 +4412,10 @@ void BlueStore::MempoolThread::_update_cache_settings() #define dout_prefix *_dout << "bluestore.OmapIteratorImpl(" << this << ") " BlueStore::OmapIteratorImpl::OmapIteratorImpl( - CollectionRef c, OnodeRef o, KeyValueDB::Iterator it) - : c(c), o(o), it(it) + PerfCounters* _logger, CollectionRef c, OnodeRef o, KeyValueDB::Iterator it) + : logger(_logger), c(c), o(o), it(it) { + logger->inc(l_bluestore_omap_iterator_count); std::shared_lock l(c->lock); if (o->onode.has_omap()) { o->get_omap_key(string(), &head); @@ -4422,6 +4423,10 @@ BlueStore::OmapIteratorImpl::OmapIteratorImpl( it->lower_bound(head); } } +BlueStore::OmapIteratorImpl::~OmapIteratorImpl() +{ + logger->dec(l_bluestore_omap_iterator_count); +} string BlueStore::OmapIteratorImpl::_stringify() const { @@ -5238,7 +5243,15 @@ void BlueStore::_init_logger() "Sum for extents that have been merged due to garbage " "collection"); //**************************************** - + // misc + //**************************************** + b.add_u64_counter(l_bluestore_omap_iterator_count, "omap_iterator_count", + "Open omap iterators count"); + b.add_u64_counter(l_bluestore_omap_rmkeys_count, "omap_rmkeys_count", + "amount of omap keys removed via rmkeys"); + b.add_u64_counter(l_bluestore_omap_rmkey_ranges_count, "omap_rmkey_range_count", + "amount of omap key ranges removed via rmkeys"); + //**************************************** // other client ops latencies //**************************************** b.add_time_avg(l_bluestore_omap_seek_to_first_lat, "omap_seek_to_first_lat", @@ -10582,7 +10595,7 @@ void BlueStore::_reap_collections() } } -void BlueStore::_update_cache_logger() +void BlueStore::_update_logger() { uint64_t num_onodes = 0; uint64_t num_pinned_onodes = 0; @@ -12157,7 +12170,7 @@ ObjectMap::ObjectMapIterator BlueStore::get_omap_iterator( bounds.upper_bound = std::move(upper_bound); } KeyValueDB::Iterator it = db->get_iterator(o->get_omap_prefix(), 0, std::move(bounds)); - return ObjectMap::ObjectMapIterator(new OmapIteratorImpl(c, o, it)); + return ObjectMap::ObjectMapIterator(new OmapIteratorImpl(logger,c, o, it)); } // ----------------- @@ -16538,7 +16551,6 @@ int BlueStore::_omap_rmkeys(TransContext *txc, auto p = bl.cbegin(); __u32 num; string final_key; - if (!o->onode.has_omap()) { goto out; } @@ -16547,6 +16559,7 @@ int BlueStore::_omap_rmkeys(TransContext *txc, o->get_omap_key(string(), &final_key); size_t base_key_len = final_key.size(); decode(num, p); + logger->inc(l_bluestore_omap_rmkeys_count, num); while (num--) { string key; decode(key, p); @@ -16580,6 +16593,7 @@ int BlueStore::_omap_rmkey_range(TransContext *txc, o->flush(); o->get_omap_key(first, &key_first); o->get_omap_key(last, &key_last); + logger->inc(l_bluestore_omap_rmkey_ranges_count); txc->t->rm_range_keys(prefix, key_first, key_last); dout(20) << __func__ << " remove range start: " << pretty_binary_string(key_first) << " end: " @@ -16588,7 +16602,6 @@ int BlueStore::_omap_rmkey_range(TransContext *txc, txc->note_modified_object(o); out: - dout(10) << __func__ << " " << c->cid << " " << o->oid << " = " << r << dendl; return r; } diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index b1f409f7b225..71061b617cf2 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -188,6 +188,13 @@ enum { l_bluestore_gc_merged, //**************************************** + // misc + //**************************************** + l_bluestore_omap_iterator_count, + l_bluestore_omap_rmkeys_count, + l_bluestore_omap_rmkey_ranges_count, + //**************************************** + // other client ops latencies //**************************************** l_bluestore_omap_seek_to_first_lat, @@ -1506,15 +1513,17 @@ public: }; class OmapIteratorImpl : public ObjectMap::ObjectMapIteratorImpl { + + PerfCounters* logger = nullptr; CollectionRef c; OnodeRef o; KeyValueDB::Iterator it; std::string head, tail; std::string _stringify() const; - public: - OmapIteratorImpl(CollectionRef c, OnodeRef o, KeyValueDB::Iterator it); + OmapIteratorImpl(PerfCounters* l, CollectionRef c, OnodeRef o, KeyValueDB::Iterator it); + virtual ~OmapIteratorImpl(); int seek_to_first() override; int upper_bound(const std::string &after) override; int lower_bound(const std::string &to) override; @@ -2622,7 +2631,7 @@ private: CollectionRef _get_collection_by_oid(const ghobject_t& oid); void _queue_reap_collection(CollectionRef& c); void _reap_collections(); - void _update_cache_logger(); + void _update_logger(); void _assign_nid(TransContext *txc, OnodeRef o); uint64_t _assign_blobid(TransContext *txc);