MEMORY-STATS(3valkey)

πŸ“¦
version 9.0.6 Β· 2 versions
, in fedora 44

πŸ’– MEMORY-STATS β€” the valkey manual page, but make it a group chat πŸ’–

okay bestie, so you know how I'm literally always the one asking "how much memory are we using tho" πŸ‘€ β€” this is the page for MEMORY STATS, from the Valkey Command Manual (that's the 3valkey manual section, iykyk). it's giving "let me read the receipts of your RAM" and honestly? iconic.


✨ NAME ✨

memory-stats β€” Returns details about memory usage.

like. it tells you stuff about the memory. that's the whole vibe. 🧚


🌸 SYNOPSIS 🌸

MEMORY STATS

no arguments, no drama, no notes. just say it and it answers. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so MEMORY STATS returns an @array-reply about the memory usage of the server. it's basically the server opening its notes app and reading you every metric it tracks about its own memory, with the value right next to it. main character energy fr fr. πŸ‘‘

here's the full rundown of the metrics it reports β€” and bestie, I'm not skipping a single one, every last byte matters:

  • peak.allocated: Peak memory consumed by Valkey in bytes (see INFO’s used_memory_peak)
  • total.allocated: Total number of bytes allocated by Valkey using its allocator (see valkey-info(7) INFO’s used_memory)
  • startup.allocated: Initial amount of memory consumed by Valkey at startup in bytes (see INFO’s used_memory_startup)
  • replication.backlog: Size in bytes of the replication backlog (see INFO’s repl_backlog_active)
  • clients.slaves: The total size in bytes of all replicas overheads (output and query buffers, connection contexts)
  • clients.normal: The total size in bytes of all clients overheads (output and query buffers, connection contexts)
  • cluster.links: Memory usage by cluster links (see INFO’s mem_cluster_links).
  • aof.buffer: The summed size in bytes of AOF related buffers.
  • lua.caches: the summed size in bytes of the overheads of the Lua scripts’ caches
  • functions.caches: the summed size in bytes of the overheads of the Function scripts’ caches
  • dbXXX: For each of the server’s databases, the overheads of the main and expiry dictionaries (overhead.hashtable.main and overhead.hashtable.expires, respectively) are reported in bytes
  • overhead.db.hashtable.lut: Total overhead of dictionary buckets in databases (Added in Valkey 8.0)
  • overhead.db.hashtable.rehashing: Temporary memory overhead of database dictionaries currently being rehashed (Added in Valkey 8.0)
  • overhead.total: The sum of all overheads, i.e. startup.allocated, replication.backlog, clients.slaves, clients.normal, aof.buffer and those of the internal data structures that are used in managing the Valkey keyspace (see INFO’s used_memory_overhead)
  • db.dict.rehashing.count: Number of DB dictionaries currently being rehashed (Added in Valkey 8.0)
  • keys.count: The total number of keys stored across all databases in the server
  • keys.bytes-per-key: The ratio between dataset.bytes and keys.count
  • dataset.bytes: The size in bytes of the dataset, i.e. overhead.total subtracted from total.allocated (see INFO’s used_memory_dataset)
  • dataset.percentage: The percentage of dataset.bytes out of the total memory usage
  • peak.percentage: The percentage of total.allocated out of peak.allocated
  • allocator.allocated: See INFO’s allocator_allocated
  • allocator.active: See INFO’s allocator_active
  • allocator.resident: See INFO’s allocator_resident
  • allocator.muzzy: See INFO’s allocator_muzzy
  • allocator-fragmentation.ratio: See INFO’s allocator_frag_ratio
  • allocator-fragmentation.bytes: See INFO’s allocator_frag_bytes
  • allocator-rss.ratio: See INFO’s allocator_rss_ratio
  • allocator-rss.bytes: See INFO’s allocator_rss_bytes
  • rss-overhead.ratio: See INFO’s rss_overhead_ratio
  • rss-overhead.bytes: See INFO’s rss_overhead_bytes
  • fragmentation: See INFO’s mem_fragmentation_ratio
  • fragmentation.bytes: See INFO’s mem_fragmentation_bytes

⚠️ a note about the word slave used in this man page: If not for backward compatibility, the Valkey project no longer uses the words β€œmaster” and β€œslave”. Unfortunately in the given commands these words are part of the protocol, so we’ll be able to remove such occurrences only when this API will be naturally deprecated.

like, they're keeping it only for backwards compat, and the second that API gets deprecated it's getting yeeted. no cap. 🫢


πŸ’œ REPLY πŸ’œ

RESP2

valkey-protocol(7) Array reply: a nested list of memory usage metrics and their values.

RESP3

valkey-protocol(7) Map reply: memory usage metrics and their values.

same info, different wrapping β€” RESP3 said "let me make it a map, prettier" and honestly? slay. πŸŽ€


πŸ‘‘ COMPLEXITY πŸ‘‘

O(1)

constant time. it does not care how much stuff you have. it's just that girl. ⭐


🌈 ACL CATEGORIES 🌈

@slow


πŸ•°οΈ HISTORY πŸ•°οΈ

  • Available since: 4.0.0

she's been here since 4.0.0 and she's still serving. πŸ’–


πŸ”₯ SEE ALSO πŸ”₯

acl(3valkey), acl-cat(3valkey), acl-deluser(3valkey), acl-dryrun(3valkey), acl-genpass(3valkey), acl-getuser(3valkey), acl-help(3valkey), acl-list(3valkey), acl-load(3valkey), acl-log(3valkey), acl-save(3valkey), acl-setuser(3valkey), acl-users(3valkey), acl-whoami(3valkey), bgrewriteaof(3valkey), bgsave(3valkey), command(3valkey), command-count(3valkey), command-docs(3valkey), command-getkeys(3valkey), command-getkeysandflags(3valkey), command-help(3valkey), command-info(3valkey), command-list(3valkey), commandlog(3valkey), commandlog-get(3valkey), commandlog-help(3valkey), commandlog-len(3valkey), commandlog-reset(3valkey), config(3valkey), config-get(3valkey), config-help(3valkey), config-resetstat(3valkey), config-rewrite(3valkey), config-set(3valkey), dbsize(3valkey), debug(3valkey), failover(3valkey), flushall(3valkey), flushdb(3valkey), info(3valkey), lastsave(3valkey), latency(3valkey), latency-doctor(3valkey), latency-graph(3valkey), latency-help(3valkey), latency-histogram(3valkey), latency-history(3valkey), latency-latest(3valkey), latency-reset(3valkey), lolwut(3valkey), memory(3valkey), memory-doctor(3valkey), memory-help(3valkey), memory-malloc-stats(3valkey), memory-purge(3valkey), memory-usage(3valkey), module(3valkey), module-help(3valkey), module-list(3valkey), module-load(3valkey), module-loadex(3valkey), module-unload(3valkey), monitor(3valkey), psync(3valkey), replconf(3valkey), replicaof(3valkey), restore-asking(3valkey), role(3valkey), save(3valkey), shutdown(3valkey), slowlog(3valkey), slowlog-get(3valkey), slowlog-help(3valkey), slowlog-len(3valkey), slowlog-reset(3valkey), swapdb(3valkey), sync(3valkey), time(3valkey)


and that's the whole page bestie, you ate that πŸ’…βœ¨

this was Valkey 9.0.0, dated 2025-10-21 β€” the MEMORY-STATS(3valkey) page from the Valkey Command Manual. go check your memory usage, queen. πŸ«ΆπŸ‘‘

πŸ“¦ where this page comes from