内存统计

Syntax
MEMORY STATS
Available since:
4.0.0
Time complexity:
O(1)
ACL categories:
@slow,

MEMORY STATS 命令返回一个关于服务器内存使用情况的 Array reply

关于内存使用的信息以指标及其各自的值提供。报告了以下指标:

  • peak.allocated: Redis 消耗的峰值内存,以字节为单位(参见 INFOused_memory_peak
  • total.allocated: Redis 使用其分配器分配的总字节数(参见 INFOused_memory
  • startup.allocated: Redis启动时消耗的初始内存量,单位为字节(参见INFOused_memory_startup
  • replication.backlog: 复制积压的大小,以字节为单位(参见 INFOrepl_backlog_active
  • clients.slaves: 所有副本开销的总大小(以字节为单位)(输出和查询缓冲区,连接上下文)
  • clients.normal: 所有客户端开销的总大小(以字节为单位)(输出和查询缓冲区,连接上下文)
  • cluster.links: 集群链接的内存使用情况(在 Redis 7.0 中添加,参见 INFOmem_cluster_links)。
  • aof.buffer: AOF相关缓冲区的总大小(以字节为单位)。
  • lua.caches: Lua脚本缓存开销的总大小(以字节为单位)
  • functions.caches: 函数脚本缓存开销的总大小(以字节为单位)
  • dbXXX: 对于服务器的每个数据库,主字典和过期字典的开销(分别为overhead.hashtable.mainoverhead.hashtable.expires)以字节为单位报告
  • overhead.db.hashtable.lut: 数据库中字典桶的总开销(在 Redis 7.4 中添加)
  • overhead.db.hashtable.rehashing: 当前正在重新哈希的数据库字典的临时内存开销(在 Redis 7.4 中添加)
  • overhead.total: 所有开销的总和,即 startup.allocatedreplication.backlogclients.slavesclients.normalaof.buffer 以及 用于管理 Redis 键空间的内部数据结构的开销(参见 INFOused_memory_overhead
  • db.dict.rehashing.count: 当前正在重新哈希的数据库字典数量(在 Redis 7.4 中添加)
  • keys.count: 服务器中所有数据库中存储的键的总数
  • keys.bytes-per-key: dataset.byteskeys.count 之间的比率
  • dataset.bytes: 数据集的大小(以字节为单位),即从total.allocated中减去overhead.total(参见INFOused_memory_dataset
  • dataset.percentage: dataset.bytes 占总内存使用量的百分比
  • peak.percentage: total.allocatedpeak.allocated 的百分比
  • allocator.allocated: 参见 INFOallocator_allocated
  • allocator.active: 参见 INFOallocator_active
  • allocator.resident: 参见 INFOallocator_resident
  • allocator.muzzy: 参见 INFOallocator_muzzy
  • allocator-fragmentation.ratio: 参见 INFOallocator_frag_ratio
  • allocator-fragmentation.bytes: 参见 INFOallocator_frag_bytes
  • allocator-rss.ratio: 参见 INFOallocator_rss_ratio
  • allocator-rss.bytes: 参见 INFOallocator_rss_bytes
  • rss-overhead.ratio: 参见 INFOrss_overhead_ratio
  • rss-overhead.bytes: 参见 INFOrss_overhead_bytes
  • fragmentation: 参见 INFOmem_fragmentation_ratio
  • fragmentation.bytes: 参见 INFOmem_fragmentation_bytes

关于本手册页中使用的“slave”一词的说明:从Redis 5开始,如果不是为了向后兼容,Redis项目不再使用“slave”一词。不幸的是,在这个命令中,“slave”一词是协议的一部分,因此我们只能在该API自然弃用时才能删除这些出现的情况。

RESP2 回复

Array reply: a nested list of memory usage metrics and their values.

RESP3 回复

Map reply: memory usage metrics and their values.
RATE THIS PAGE
Back to top ↑