Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do used_memory_peak_perc and used_memory_dataset_perc mean?

Tags:

redis

These are the memory usage stats from my redis instance. I'm unsure of what used_memory_peak_perc and used_memory_dataset_perc mean -- and when I should start to get concerned? Especially since the latter is edging closer to 100%.

# Memory
used_memory:454041104
used_memory_human:433.01M
used_memory_rss:558338048
used_memory_rss_human:532.47M
used_memory_peak:867680576
used_memory_peak_human:827.48M
used_memory_peak_perc:52.33%
used_memory_overhead:93054648
used_memory_startup:3662104
used_memory_dataset:360986456
used_memory_dataset_perc:80.15%
used_memory_lua:37888
used_memory_lua_human:37.00K
maxmemory:9901336167
maxmemory_human:9.22G
maxmemory_policy:volatile-lru
mem_fragmentation_ratio:1.23
mem_allocator:jemalloc-4.0.3
active_defrag_running:0
lazyfree_pending_objects:0
like image 396
Vik Avatar asked Oct 24 '18 17:10

Vik


People also ask

What is Used_memory_rss?

used_memory_rss : Number of bytes that Redis allocated as seen by the operating system (a.k.a resident set size). This is the number reported by tools such as top(1) and ps(1)

How do I check my Redis Maxmemory policy?

First, the client runs the command to add new data. Before the command is executed, Redis check if the memory usage is higher than the set maxmemory limit. If the limit is reached, it uses the specified eviction policy to remove the keys. Finally, the command is executed, and new data is added.


1 Answers

There is nothing concerning about 'used_memory_dataset_perc' getting closer to 100% - in theory, it can only get close to it but never quite reach it. That metric reflects the portion of user data from the overall memory currently allocated ('used_memory_rss').

Similarly, 'used_memory_peak_perc' attempts to reflect the same ratio but instead of the current allocation it uses the peak allocation experienced during the instance's lifetime (or stats reset).

What you do need to monitor is 'used_memory_rss` to make sure you don't run out of resources (i.e. RAM, and 'used_memory_dataset' to avoid getting into OOM/eviction if that's not wanted.

Note that 'maxmemory' defines the maximal size of the dataset (i.e. the upper limit for 'used_memory_dataset'), whereas 'used_memory_rss' is the actual memory allocated to Redis from the OS' perspective. 'used_memory_rss' includes the data, all of the server's overheads (e.g. data structures, buffers, etc...) and may be fragmented. That means that when your 'used_memory_dataset' reaches 'maxmemory', 'used_memory_rss' may be significantly bigger than 'maxmemory'.

like image 130
Itamar Haber Avatar answered Mar 23 '23 01:03

Itamar Haber