Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Memory REDIS高内存使用率_Memory_Redis - Fatal编程技术网

Memory REDIS高内存使用率

Memory REDIS高内存使用率,memory,redis,Memory,Redis,我们已经编写了670万个密钥,其值大小为600字节。预计总内存使用量为4.2GB,但我们注意到rss内存使用量为5.7GB 为什么redis使用额外的2GB内存 内存信息命令输出 info memory # Memory used_memory:5913620368 used_memory_human:5.51G used_memory_rss:6065446912 used_memory_rss_human:5.65G used_memory_peak:5913639024 used

我们已经编写了670万个密钥,其值大小为600字节。预计总内存使用量为4.2GB,但我们注意到rss内存使用量为5.7GB

为什么redis使用额外的2GB内存

内存信息命令输出

     info memory
# Memory
used_memory:5913620368
used_memory_human:5.51G
used_memory_rss:6065446912
used_memory_rss_human:5.65G
used_memory_peak:5913639024
used_memory_peak_human:5.51G
used_memory_peak_perc:100.00%
used_memory_overhead:338769120
used_memory_startup:1018080
used_memory_dataset:5574851248
used_memory_dataset_perc:94.29%
allocator_allocated:5913554768
allocator_active:6065409024
allocator_resident:6065409024
total_system_memory:34359738368
total_system_memory_human:32.00G
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:0
maxmemory_human:0B
maxmemory_policy:noeviction
allocator_frag_ratio:1.03
allocator_frag_bytes:151854256
allocator_rss_ratio:1.00
allocator_rss_bytes:0
rss_overhead_ratio:1.00
rss_overhead_bytes:37888
mem_fragmentation_ratio:1.03
mem_fragmentation_bytes:151892144
mem_not_counted_for_evict:3738
mem_replication_backlog:0
mem_clients_slaves:0
mem_clients_normal:17440
mem_aof_buffer:4096
mem_allocator:libc
active_defrag_running:0
lazyfree_pending_objects:0
redis中的键数

info keyspace
# Keyspace
db6:keys=6765516,expires=0,avg_ttl=0
请检查以下内容:


64位系统将使用比32位系统多得多的内存来存储相同的密钥,尤其是在密钥和值很小的情况下。这是因为在64位系统中,指针占用8个字节。但当然,优势在于64位系统中可以有大量内存,因此为了运行大型Redis服务器,或多或少需要64位系统。另一种选择是shardi

即使每个指针有8个字节,当总键+值大小~4.2GB时,为什么使用的内存会增加到5.9GB。您的数据类型是什么?是杂烩吗???是的。它是一个散列,只有几个字段,其中一个字段是600字节,而不是~10字节。每个散列有多少个密钥?3个字段,其中一个字段是600字节,其他字段少于10字节