微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

为什么 Redis Sorted Set 使用如此多的内存开销?

如何解决为什么 Redis Sorted Set 使用如此多的内存开销?

我正在设计一个包含约 3000 个排序集键的 Redis 数据存储,每个键有 60 - 300 个项目,每个项目的大小约为 250 字节。

used_memory_overhead = 1055498028 字节和 used_memory_dataset= 9681332 字节。这个比例似乎太高了。 used_memory_dataset_perc 小于 1%。内存使用量超过 1.16G 的最大值并导致密钥被逐出。

排序集真的有 99% 的内存开销吗?我是否只需要找到另一个解决方案?我只想要一个按值中的字段排序的值列表。

这是 MEMORY INFO输出used_memory_dataset_perc 不断减少,直到

# Memory
used_memory:399243696
used_memory_human:380.75M
used_memory_RSS:493936640
used_memory_RSS_human:471.05M
used_memory_peak:1249248448
used_memory_peak_human:1.16G
used_memory_peak_perc:31.96%
used_memory_overhead:390394038
used_memory_startup:4263448
used_memory_dataset:8849658
used_memory_dataset_perc:2.24%
allocator_allocated:399390096
allocator_active:477728768
allocator_resident:499613696
used_memory_lua:37888
used_memory_lua_human:37.00K
used_memory_scripts:0
used_memory_scripts_human:0B
number_of_cached_scripts:0
maxmemory:1248854016
maxmemory_human:1.16G
maxmemory_policy:volatile-lru
allocator_frag_ratio:1.20
allocator_frag_bytes:78338672
allocator_RSS_ratio:1.05
allocator_RSS_bytes:21884928
RSS_overhead_ratio:0.99
RSS_overhead_bytes:-5677056
mem_fragmentation_ratio:1.24
mem_fragmentation_bytes:94804256
mem_not_counted_for_evict:0
mem_replication_backlog:0
mem_clients_slaves:0
mem_clients_normal:385555150
mem_aof_buffer:0
mem_allocator:jemalloc-5.1.0
active_defrag_running:0
lazyfree_pending_objects:0

如果相关,我正在使用 AWS Elasticache

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。