Skip to main content

MEMORY STATS

Syntax

MEMORY STATS

Time complexity: O(N) where N is the number of open connections.

ACL categories: @read, @slow

The MEMORY STATS command reports how much memory the server has allocated for connections, separating regular client connections from replication flows.

The reply covers connection memory only. It does not mirror the much larger field set that Redis returns, so figures such as peak allocation or dataset size are not part of it. For a breakdown of overall server memory, use the Memory section of INFO; for allocator internals, use MEMORY MALLOC-STATS or MEMORY ARENA.

Return

Map reply: the memory usage metrics listed below. Under RESP2 the map is returned as a flat array of alternating field names and values.

FieldDescription
connections.direct_bytesBytes allocated for client connections, excluding replication connections.
replication.connections_countNumber of connections currently serving a replication flow.
replication.direct_bytesBytes allocated for those replication connections.

Examples

dragonfly> MEMORY STATS
1) "connections.direct_bytes"
2) (integer) 10936
3) "replication.connections_count"
4) (integer) 0
5) "replication.direct_bytes"
6) (integer) 0

Under RESP3 the same reply is rendered as a map:

dragonfly> MEMORY STATS
1# "connections.direct_bytes" => (integer) 10936
2# "replication.connections_count" => (integer) 0
3# "replication.direct_bytes" => (integer) 0

See also

MEMORY | MEMORY USAGE | MEMORY MALLOC-STATS | INFO