- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
通过 info
命令,我得到
mem_fragmentation_ratio:1.24
大于 1
。
我知道这意味着 redis 持有一些可以释放的空闲内存。
我怎样才能释放这个内存并降低这个比例?
我尝试了MEMORY PURGE
,但比率没有改变。
redis_version:4.0.9
# Memory
used_memory:8347302992
used_memory_human:7.77G
used_memory_rss:9236336640
used_memory_rss_human:8.60G
used_memory_peak:17919661152
used_memory_peak_human:16.69G
used_memory_peak_perc:46.58%
used_memory_overhead:519883816
used_memory_startup:1215600
used_memory_dataset:7827419176
used_memory_dataset_perc:93.79%
total_system_memory:270383198208
total_system_memory_human:251.81G
used_memory_lua:37888
used_memory_lua_human:37.00K
maxmemory:21474836480
maxmemory_human:20.00G
maxmemory_policy:noeviction
mem_fragmentation_ratio:1.11
mem_allocator:jemalloc-4.0.3
active_defrag_running:0
lazyfree_pending_objects:0
最佳答案
Redis 不太擅长释放未使用的内存。一般来说,redis 会保留它在高峰期消耗的所有内存。这通常不是问题,只要您的服务器有足够的内存来处理它。从您的信息中我可以看出,您的服务器拥有的内存比您为 Redis 主动使用的内存多得多。
明确地说,MEMORY PURGE
command仅适用于 jemalloc 内存分配器:
The MEMORY PURGE command attempts to purge dirty pages so these can be reclaimed by the allocator.
This command is currently implemented only when using jemalloc as an allocator, and evaluates to a benign NOOP for all others.
因此,如果您在 windows 或 mac 上运行 redis,您可能无法使用 MEMORY PURGE
。
不过,一般来说,我不会担心如此接近 1 的碎片率。只有当碎片率低于 1 或远高于 1(例如 10 或更多)时,问题通常才会出现。
关于redis - 如何减少 Redis 中的 mem_fragmentation_ratio?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56799931/
这是我要问你的问题:“mem_fragmentation_rateo”如何影响 Redis 的性能? 我在 stackoverflow 和 redis.io 中做了一些调查,但我找不到关于我的问题的明
通过 info 命令,我得到 mem_fragmentation_ratio:1.24 大于 1。 我知道这意味着 redis 持有一些可以释放的空闲内存。 我怎样才能释放这个内存并降低这个比例? 我
我是一名优秀的程序员,十分优秀!