check_memory_usage() recreation in OSD:tick()
Hi guys!This is a function for MDS (src/mds/MDCache.cc) that prints out the rss and other memory stats every couple seconds at debug level 2.I am trying to create a similar function for printing memory and other stats for OSD. (will be adding the code in src/osd/OSD:tick() function),can anyone provide a basic guidelines about what all classes, functions I will need to use and what all will I require for achieving so?Any help would be extremely valuable, Thanks for your time! void MDCache::check_memory_usage() { static MemoryModel mm(g_ceph_context); static MemoryModel::snap last; mm.sample(&last); static MemoryModel::snap baseline = last; // check client caps ceph_assert(CInode::count() == inode_map.size() + snap_inode_map.size() + num_shadow_inodes); double caps_per_inode = 0.0; if (CInode::count()) caps_per_inode = (double)Capability::count() / (double)CInode::count(); dout(2) << "Memory usage: " << " total " << last.get_total() << ", rss " << last.get_rss() << ", heap " << last.get_heap() << ", baseline " << baseline.get_heap() << ", " << num_inodes_with_caps << " / " << CInode::count() << " inodes have caps" << ", " << Capability::count() << " caps, " << caps_per_inode << " caps per inode" << dendl; mds->update_mlogger(); mds->mlogger->set(l_mdm_rss, last.get_rss()); mds->mlogger->set(l_mdm_heap, last.get_heap()); }
Hello! OSD already has some useful asok commands in the matter of memory profiling / stats (`get_heap_property`, `heap` -- please take a look on OSD.cc where these cmds are registered). Maybe they would suit your use-case better than printing to a log in `tick()`. Regards, Radek On Sat, Nov 11, 2023 at 4:27 AM Suyash Dongre <suyashd999@gmail.com> wrote:
Hi guys!This is a function for MDS (src/mds/MDCache.cc) that prints out the rss and other memory stats every couple seconds at debug level 2.I am trying to create a similar function for printing memory and other stats for OSD. (will be adding the code in src/osd/OSD:tick() function),can anyone provide a basic guidelines about what all classes, functions I will need to use and what all will I require for achieving so?Any help would be extremely valuable, Thanks for your time!
void MDCache::check_memory_usage() { static MemoryModel mm(g_ceph_context); static MemoryModel::snap last; mm.sample(&last); static MemoryModel::snap baseline = last;
// check client caps ceph_assert(CInode::count() == inode_map.size() + snap_inode_map.size() + num_shadow_inodes); double caps_per_inode = 0.0; if (CInode::count()) caps_per_inode = (double)Capability::count() / (double)CInode::count();
dout(2) << "Memory usage: " << " total " << last.get_total() << ", rss " << last.get_rss() << ", heap " << last.get_heap() << ", baseline " << baseline.get_heap() << ", " << num_inodes_with_caps << " / " << CInode::count() << " inodes have caps" << ", " << Capability::count() << " caps, " << caps_per_inode << " caps per inode" << dendl;
mds->update_mlogger(); mds->mlogger->set(l_mdm_rss, last.get_rss()); mds->mlogger->set(l_mdm_heap, last.get_heap()); }
_______________________________________________ Dev mailing list -- dev@ceph.io To unsubscribe send an email to dev-leave@ceph.io
FIWW, in addition to the asok commands, we also have a fair amount of memory logging you can see at debug level 5 for bluestore and the prioritycache in the logs: debug_prioritycache = "5" debug_bluestore = "5" bluestore: 2023-10-04T02:21:40.879+0000 7f5b99986700 5 bluestore.MempoolThread(0x55b9b35f9b60) _resize_shards cache_size: 13797582437 kv_alloc: 3019898880 kv_used: 25433680 kv_onode_alloc: 402653184 kv_onode_used: 44860544 meta_alloc: 2952790016 meta_used: 1284841645 data_alloc: 469762048 data_used: 5436805120 prioritycache: 2023-10-04T02:21:41.330+0000 7f5b99986700 5 prioritycache tune_memory target: 17179869184 mapped: 9872736256 unmapped: 7971979264 heap: 17844715520 old mem: 13797582437 new mem: 13797582437 Mark On 11/13/23 06:47, Radoslaw Zarzynski wrote:
Hello!
OSD already has some useful asok commands in the matter of memory profiling / stats (`get_heap_property`, `heap` -- please take a look on OSD.cc where these cmds are registered).
Maybe they would suit your use-case better than printing to a log in `tick()`.
Regards, Radek
On Sat, Nov 11, 2023 at 4:27 AM Suyash Dongre <suyashd999@gmail.com> wrote:
Hi guys!This is a function for MDS (src/mds/MDCache.cc) that prints out the rss and other memory stats every couple seconds at debug level 2.I am trying to create a similar function for printing memory and other stats for OSD. (will be adding the code in src/osd/OSD:tick() function),can anyone provide a basic guidelines about what all classes, functions I will need to use and what all will I require for achieving so?Any help would be extremely valuable, Thanks for your time!
void MDCache::check_memory_usage() { static MemoryModel mm(g_ceph_context); static MemoryModel::snap last; mm.sample(&last); static MemoryModel::snap baseline = last;
// check client caps ceph_assert(CInode::count() == inode_map.size() + snap_inode_map.size() + num_shadow_inodes); double caps_per_inode = 0.0; if (CInode::count()) caps_per_inode = (double)Capability::count() / (double)CInode::count();
dout(2) << "Memory usage: " << " total " << last.get_total() << ", rss " << last.get_rss() << ", heap " << last.get_heap() << ", baseline " << baseline.get_heap() << ", " << num_inodes_with_caps << " / " << CInode::count() << " inodes have caps" << ", " << Capability::count() << " caps, " << caps_per_inode << " caps per inode" << dendl;
mds->update_mlogger(); mds->mlogger->set(l_mdm_rss, last.get_rss()); mds->mlogger->set(l_mdm_heap, last.get_heap()); }
_______________________________________________ Dev mailing list -- dev@ceph.io To unsubscribe send an email to dev-leave@ceph.io
Dev mailing list -- dev@ceph.io To unsubscribe send an email to dev-leave@ceph.io
-- Best Regards, Mark Nelson Head of Research and Development Clyso GmbH p: +49 89 21552391 12 | a: Minnesota, USA w: https://clyso.com | e: mark.nelson@clyso.com We are hiring: https://www.clyso.com/jobs/
participants (3)
-
Mark Nelson
-
Radoslaw Zarzynski
-
Suyash Dongre