【发布时间】:2019-01-10 16:46:25
【问题描述】:
我在两个 centos 6 虚拟机中设置了一个 Redis(版本 4.0.6)哨兵集群。主从 Redis 服务器的 maxmemory 设置为 10GB,maxmemory_policy 为 volatile-lru。
问题是,两台服务器都占用了大量内存。
大师
used_memory:8959732536
used_memory_human:8.34G
used_memory_rss:14763728896
used_memory_rss_human:13.75G
used_memory_peak:10002148536
used_memory_peak_human:9.32G
used_memory_peak_perc:89.58%
used_memory_overhead:1344839894
used_memory_startup:761776
used_memory_dataset:7614892642
used_memory_dataset_perc:85.00%
total_system_memory:20957556736
total_system_memory_human:19.52G
used_memory_lua:37888
used_memory_lua_human:37.00K
maxmemory:10000000000
maxmemory_human:9.31G
maxmemory_policy:volatile-lru
mem_fragmentation_ratio:1.65
mem_allocator:jemalloc-3.6.0
active_defrag_running:0
lazyfree_pending_objects:0
从属
used_memory:8927665872
used_memory_human:8.31G
used_memory_rss:16422535168
used_memory_rss_human:15.29G
used_memory_peak:10000009472
used_memory_peak_human:9.31G
used_memory_peak_perc:89.28%
used_memory_overhead:1340505548
used_memory_startup:761792
used_memory_dataset:7587160324
used_memory_dataset_perc:84.99%
total_system_memory:20957556736
total_system_memory_human:19.52G
used_memory_lua:37888
used_memory_lua_human:37.00K
maxmemory:10000000000
maxmemory_human:9.31G
maxmemory_policy:volatile-lru
mem_fragmentation_ratio:1.84
mem_allocator:jemalloc-3.6.0
active_defrag_running:0
lazyfree_pending_objects:0
Redis 在主服务器和从服务器上分别占用 14064.8 MB 和 15664.2 MB。 我确实有很多数据存储在redis中。他们中的大多数都设置了到期日,有些没有到期日。
问题是即使将最大内存设置为 10 GB,为什么 redis 在 VM 中占用大约 15 GB。
我看到已用内存低于 10GB,而 rss 内存为 15GB。
我确实运行了 MEMORY PURGE,它清除了一些 rss 内存,但它会在几分钟内重新填充并继续增长。
关于如何控制内存消耗的任何建议或此问题的永久解决方案。我应该增加 VM 中的 RAM 吗?如果是,我应该添加多少 RAM 来处理这种情况。
【问题讨论】: