tiny-rdm icon indicating copy to clipboard operation
tiny-rdm copied to clipboard

[FEATURE]memory stats

Open ddatsh opened this issue 1 year ago • 3 comments
trafficstars

redis 4.0 之前,只能通过info memory查看 redis 实例的内存大体使用状况,而无法了解内存的具体使用细节,比如expire的消耗,client output buffer, query buffer等是很难直观显示的。该指令能够展现redis内部内存使用细节;

执行结果示例及对应参数解析:

  1. "peak.allocated" # redis从启动来,allocator分配的内存峰值
  2. (integer) 2290242368
  3. "total.allocated" # allocator分配当前内存字节数
  4. (integer) 2290241776
  5. "startup.allocated" # redis启动完成使用的内存字节数
  6. (integer) 6315320
  7. "clients.normal" # 所有一般客户端消耗内存节字数,即所有flag为N的客户端内存使用
  8. (integer) 150754
  9. "aof.buffer" # aof buffer使用内存字节数,一般较小,在aof rewrite时会变得较大
  10. (integer) 0
  11. "lua.caches" # 所有lua脚本占用的内存节字数
  12. (integer) 0
  13. "db.0"
    1. "overhead.hashtable.main" # 对应db的所有key的hash表总的内存节字数
    2. (integer) 680720488
    3. "overhead.hashtable.expires" # 对应db的过期key的hash表总的内存节字数
    4. (integer) 416
  14. "overhead.total" # redis总的分配的内存的字节数
  15. (integer) 687186978
  16. "keys.count" # 整个实例key的个数,相同于dbsize返回值
  17. (integer) 13662569
  18. "keys.bytes-per-key" # 每个key平均占用字节数;把overhead也均摊到每个key上
  19. (integer) 167
  20. "dataset.bytes" # 表示redis数据集占用的内存容量,即分配的内存总量减去 overhead.total
  21. (integer) 1603054798
  22. "dataset.percentage" # 表示redis数据占用内存占总内存分配的百分比
  23. "70.188545227050781"
  24. "peak.percentage" # 当前内存使用量在峰值时的占比
  25. "99.999977111816406"
  26. "allocator.allocated" # 该参数不同与 total.allocated, 它计算所有分配的内存大小(不仅仅是使用zmalloc分配的)
  27. (integer) 2291632296
  28. "allocator.active" # 与常驻内存allocator.resident不同,这不包括jemalloc申请的还未使用的内存
  29. (integer) 2293006336
  30. "allocator.resident" # 与RSS不同,这不包括来自共享库和其他非堆映射的RSS
  31. (integer) 2340564992
  32. "allocator-fragmentation.ratio" # 等于 allocator.active / allocator.allocated
  33. "1.0005995035171509"
  34. "allocator-fragmentation.bytes" # 等于 allocator.active - allocator.allocated
  35. (integer) 1374040
  36. "allocator-rss.ratio" # 等于 allocator.resident / allocator.active
  37. "1.0207407474517822"
  38. "allocator-rss.bytes" # 等于 allocator.resident - allocator.active
  39. (integer) 47558656
  40. "rss-overhead.ratio" # 等于 RSS / allocator.resident
  41. "0.99930697679519653"
  42. "rss-overhead.bytes" # 等于 RSS - allocator.resident
  43. (integer) -1622016
  44. "fragmentation" # 等于 RSS / total.allocated
  45. "1.0212923288345337"
  46. "fragmentation.bytes" # 等于 RSS - total.allocated
  47. (integer) 48763208

ddatsh avatar Aug 14 '24 14:08 ddatsh

👍🏻,列得很详细。不过我没看明白Feature需求是什么😂

tiny-craft avatar Aug 15 '24 09:08 tiny-craft

  • 822"
  • "allocator-rss.bytes" # 等于 allocator.resident - allocator.active
  • (integer) 47558656
  • "rss-overhead.ratio" # 等于 RSS / allocator.resident
  • "0.99930697679519653"
  • "rss-overhead.bytes" # 等于 RSS - allocator.resident
  • (integer) -1622016
  • "fragmentation" # 等于 RSS / total.allocated
  • "1.0212923288345337"

在rdm 信息里,除info memory取到的,再加一些memory stats 出来的字段?

ddatsh avatar Aug 15 '24 11:08 ddatsh

哦,可以考虑。

你这些每个参数的用途,也给我一些灵感,应该给info里面每项加个注释之类的,因为大部分人不会记得所有项的意思😂

tiny-craft avatar Aug 16 '24 02:08 tiny-craft