basho / riak_core

Distributed systems infrastructure used by Riak.
Apache License 2.0
1.23k stars 392 forks source link

ps-like dump of memory usage of processes in riak supervisor tree #991

Closed hmmr closed 1 year ago

hmmr commented 1 year ago

riak_core_supps:q(Options) will print the memory usage, message queue length and total heap size of processes in the supervision tree under several top-level supervisors (riak_core_sup, riak_kv_sup, riak_repl_sup, riak_pipe_sup and riak_api_sup):

(riak@127.0.0.1)1> riak_core_supps:q([]).
============ Node: riak@127.0.0.1 ===========================
        mem        mq        ths        pid           process
-------------------------------------------------------------
    4483020                                           riak_core_sup (22)
    3788464                                             riak_core_vnode_sup (128)
     350720                                             riak_core_vnode_proxy_sup (128)
      55184         0       6772        <0.1554.0>      riak_core_ring_events
      55132         0       6772        <0.1555.0>      riak_core_ring_manager
      42116         0       4185        <0.1570.0>      riak_core_vnode_manager
      34356         0       4185        <0.1573.0>      riak_core_claimant
      21944         0       2586        <0.1569.0>      riak_core_node_watcher
      21720                                             riak_core_stat_sup (1)
      21644         0       2586        <0.1571.0>      riak_core_capability
      21564         0       2586        <0.1572.0>      riak_core_gossip
      21564         0       2586        <0.1566.0>      riak_core_broadcast
      13920                                             riak_core_node_worker_pool_sup (5)
       5628                                             riak_core_handoff_sup (4)
       5568                                             riak_core_eventhandler_sup (2)
       3964         0        376        <0.1564.0>      riak_core_metadata_hashtree
       2864         0        233        <0.1559.0>      riak_core_metadata_manager
       2820         0        233        <0.1574.0>      riak_core_table_owner
       2800         0        233        <0.1546.0>      riak_core_dist_mon
       2784         0        233        <0.1568.0>      riak_core_node_watcher_events
       2784         0        233        <0.1543.0>      riak_core_sysmon_minder
       2740                                             riak_core_metadata_evt_sup (1)
       2740         0        233        <0.1542.0>      riak_core_bg_manager
...

It can be used from remote shell as a debugging aid; the idea is to hook into riak_core_console and expose it as a riak-admin command. Options are described here.

martinsumner commented 1 year ago

Thanks @hmmr - I think this is a neat idea, and would be very useful