mirror of
https://github.com/ceph/ceph
synced 2025-02-19 08:57:27 +00:00
os/bluestore: add perf counters for cache size
Onodes, buffers, buffer bytes. Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
parent
6098761000
commit
33e26d021d
@ -2435,10 +2435,16 @@ void BlueStore::_init_logger()
|
||||
b.add_u64(l_bluestore_compressed_original, "bluestore_compressed_original",
|
||||
"Sum for original bytes that were compressed");
|
||||
|
||||
b.add_u64(l_bluestore_onodes, "bluestore_onodes",
|
||||
"Number of onodes in cache");
|
||||
b.add_u64(l_bluestore_onode_hits, "bluestore_onode_hits",
|
||||
"Sum for onode-lookups hit in the cache");
|
||||
b.add_u64(l_bluestore_onode_misses, "bluestore_onode_misses",
|
||||
"Sum for onode-lookups missed in the cache");
|
||||
b.add_u64(l_bluestore_buffers, "bluestore_buffers",
|
||||
"Number of buffers in cache");
|
||||
b.add_u64(l_bluestore_buffer_bytes, "bluestore_buffer_bytes",
|
||||
"Number of buffer bytes in cache");
|
||||
b.add_u64(l_bluestore_buffer_hit_bytes, "bluestore_buffer_hit_bytes",
|
||||
"Sum for bytes of read hit in the cache");
|
||||
b.add_u64(l_bluestore_buffer_miss_bytes, "bluestore_buffer_miss_bytes",
|
||||
@ -4516,6 +4522,19 @@ void BlueStore::_reap_collections()
|
||||
}
|
||||
}
|
||||
|
||||
void BlueStore::_update_cache_logger()
|
||||
{
|
||||
uint64_t num_onodes = 0;
|
||||
uint64_t num_buffers = 0;
|
||||
uint64_t num_buffer_bytes = 0;
|
||||
for (auto c : cache_shards) {
|
||||
c->add_stats(&num_onodes, &num_buffers, &num_buffer_bytes);
|
||||
}
|
||||
logger->set(l_bluestore_onodes, num_onodes);
|
||||
logger->set(l_bluestore_buffers, num_buffers);
|
||||
logger->set(l_bluestore_buffer_bytes, num_buffer_bytes);
|
||||
}
|
||||
|
||||
// ---------------
|
||||
// read operations
|
||||
|
||||
@ -6348,6 +6367,8 @@ void BlueStore::_kv_sync_thread()
|
||||
// this is as good a place as any ...
|
||||
_reap_collections();
|
||||
|
||||
_update_cache_logger();
|
||||
|
||||
if (bluefs) {
|
||||
if (!bluefs_gift_extents.empty()) {
|
||||
_commit_bluefs_freespace(bluefs_gift_extents);
|
||||
|
@ -72,8 +72,11 @@ enum {
|
||||
l_bluestore_compressed,
|
||||
l_bluestore_compressed_allocated,
|
||||
l_bluestore_compressed_original,
|
||||
l_bluestore_onodes,
|
||||
l_bluestore_onode_hits,
|
||||
l_bluestore_onode_misses,
|
||||
l_bluestore_buffers,
|
||||
l_bluestore_buffer_bytes,
|
||||
l_bluestore_buffer_hit_bytes,
|
||||
l_bluestore_buffer_miss_bytes,
|
||||
l_bluestore_write_big,
|
||||
@ -714,6 +717,9 @@ public:
|
||||
|
||||
virtual void trim(uint64_t onode_max, uint64_t buffer_max) = 0;
|
||||
|
||||
virtual void add_stats(uint64_t *onodes, uint64_t *buffers,
|
||||
uint64_t *bytes) = 0;
|
||||
|
||||
#ifdef DEBUG_CACHE
|
||||
virtual void _audit(const char *s) = 0;
|
||||
#else
|
||||
@ -785,6 +791,14 @@ public:
|
||||
|
||||
void trim(uint64_t onode_max, uint64_t buffer_max) override;
|
||||
|
||||
void add_stats(uint64_t *onodes, uint64_t *buffers,
|
||||
uint64_t *bytes) override {
|
||||
std::lock_guard<std::recursive_mutex> l(lock);
|
||||
*onodes += onode_lru.size();
|
||||
*buffers += buffer_lru.size();
|
||||
*bytes += buffer_size;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_CACHE
|
||||
void _audit(const char *s) override;
|
||||
#endif
|
||||
@ -860,6 +874,14 @@ public:
|
||||
|
||||
void trim(uint64_t onode_max, uint64_t buffer_max) override;
|
||||
|
||||
void add_stats(uint64_t *onodes, uint64_t *buffers,
|
||||
uint64_t *bytes) override {
|
||||
std::lock_guard<std::recursive_mutex> l(lock);
|
||||
*onodes += onode_lru.size();
|
||||
*buffers += buffer_hot.size() + buffer_warm_in.size();
|
||||
*bytes += buffer_bytes;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_CACHE
|
||||
void _audit(const char *s) override;
|
||||
#endif
|
||||
@ -1416,6 +1438,7 @@ private:
|
||||
CollectionRef _get_collection(const coll_t& cid);
|
||||
void _queue_reap_collection(CollectionRef& c);
|
||||
void _reap_collections();
|
||||
void _update_cache_logger();
|
||||
|
||||
void _assign_nid(TransContext *txc, OnodeRef o);
|
||||
uint64_t _assign_blobid(TransContext *txc);
|
||||
|
Loading…
Reference in New Issue
Block a user