Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to view redis memory usage

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Redis memory usage "> how to view redis memory usage

Redis is an open source (BSD licensed), in-memory data structure storage system that can be used as database, cache, and messaging middleware. One of the basic characteristics of Redis is memory database, because its data is placed in memory, so query and operation is very fast, but we are also worried about taking up too much memory, so how to check the memory usage of Redis?

Tools / raw materials

Redis

Redis client

Methods / steps

Use the Redis client to connect to Redis to ensure that the Redis command can be executed. The client I use is Redis Desktop Manager, of course, I can also use Xshell.

Auth redis105

Execute info memory to query Redis memory usage information

Analyze query results

Used_memory: the total amount of memory allocated by the Redis allocator in byte

Used_memory_human: returns the total amount of memory allocated by Redis in a human readable format

Used_memory_rss: returns the total amount of memory allocated by Redis (commonly known as resident set size) from an operating system perspective. This value is consistent with the output of top, ps, and so on.

Analyze query results 2

Used_memory_peak: peak memory consumption of Redis (in bytes)

Used_memory_peak_human: returns the peak memory consumption of Redis in a human-readable format

Used_memory_lua: the amount of memory used by the Lua engine in bytes

Mem_fragmentation_ratio: the ratio between used_memory_rss and used_memory

Mem_allocator: the memory allocator used by Redis specified at compile time. It can be libc, jemalloc, or tcmalloc.

Compare several values

1) when rss > used, and there is a large difference between the two values, it indicates that there is memory fragmentation (internal or external).

The ratio of memory fragmentation can be seen by the value of mem_fragmentation_ratio.

2) when used > rss, part of the memory of the Redis is swapped out to the swap space by the operating system. In this case, the operation may cause significant delay.

When Redis frees memory, the allocator may or may not return memory to the operating system.

If Redis frees memory but does not return it to the operating system, the value of used_memory may not match the Redis footprint displayed by the operating system. Check the value of used_memory_peak to verify that this is happening.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report