Returns details about memory usage.
MEMORY
STATS
The MEMORY STATS
command returns an @array-reply about the
memory usage of the server.
The information about memory usage is provided as metrics and their respective values. The following metrics are reported:
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 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’ cachesfunctions.caches
: the summed size in bytes of the
overheads of the Function scripts’ cachesdbXXX
: 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
bytesoverhead.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 serverkeys.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 usagepeak.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.
Array reply: a nested list of memory usage metrics and their values.
Map reply: memory usage metrics and their values.
O(1)
@slow
ACL, ACL CAT, ACL DELUSER, ACL DRYRUN, ACL GENPASS, ACL GETUSER, ACL HELP, ACL LIST, ACL LOAD, ACL LOG, ACL SAVE, ACL SETUSER, ACL USERS, ACL WHOAMI, BGREWRITEAOF, BGSAVE, COMMAND, COMMAND COUNT, COMMAND DOCS, COMMAND GETKEYS, COMMAND GETKEYSANDFLAGS, COMMAND HELP, COMMAND INFO, COMMAND LIST, CONFIG, CONFIG GET, CONFIG HELP, CONFIG RESETSTAT, CONFIG REWRITE, CONFIG SET, DBSIZE, DEBUG, FAILOVER, FLUSHALL, FLUSHDB, INFO, LASTSAVE, LATENCY, LATENCY DOCTOR, LATENCY GRAPH, LATENCY HELP, LATENCY HISTOGRAM, LATENCY HISTORY, LATENCY LATEST, LATENCY RESET, LOLWUT, MEMORY, MEMORY DOCTOR, MEMORY HELP, MEMORY MALLOC-STATS, MEMORY PURGE, MEMORY USAGE, MODULE, MODULE HELP, MODULE LIST, MODULE LOAD, MODULE LOADEX, MODULE UNLOAD, MONITOR, PSYNC, REPLCONF, REPLICAOF, RESTORE-ASKING, ROLE, SAVE, SHUTDOWN, SLOWLOG, SLOWLOG GET, SLOWLOG HELP, SLOWLOG LEN, SLOWLOG RESET, SWAPDB, SYNC, TIME.