Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

内存泄漏问题 #59

Open
ida1kd opened this issue Oct 9, 2023 · 1 comment
Open

内存泄漏问题 #59

ida1kd opened this issue Oct 9, 2023 · 1 comment

Comments

@ida1kd
Copy link

ida1kd commented Oct 9, 2023

  1. 模拟数据 插入以下结构的大约数据 1万个
    exhset us:126902 session:dea155d63828f002484fb2d67a879c81 "" EX 60
  2. 查看每个数据占用内存情况 (大约152)
    127.0.0.1:6379> memory usage us:105681
    (integer) 152
  3. 但总内存占用 100M
    127.0.0.1:6379> info memory

Memory

used_memory:105388744
used_memory_human:100.51M
问题:按道理算 10000 * 152 = 1.449M 那为什么会占用 100M内存

测试了三种模式,都是占用这么多内存,希望得到回复

Memory

used_memory:105388744
used_memory_human:100.51M
used_memory_rss:118505472
used_memory_rss_human:113.02M
used_memory_peak:105447208
used_memory_peak_human:100.56M
used_memory_peak_perc:99.94%
used_memory_overhead:1407072
used_memory_startup:929088
used_memory_dataset:103981672
used_memory_dataset_perc:99.54%
allocator_allocated:105497072
allocator_active:105697280
allocator_resident:109481984
total_system_memory:16573603840
total_system_memory_human:15.44G
used_memory_lua:31744
used_memory_vm_eval:31744
used_memory_lua_human:31.00K
used_memory_scripts_eval:0
number_of_cached_scripts:0
number_of_functions:0
number_of_libraries:0
used_memory_vm_functions:32768
used_memory_vm_total:64512
used_memory_vm_total_human:63.00K
used_memory_functions:184
used_memory_scripts:184
used_memory_scripts_human:184B
maxmemory:0
maxmemory_human:0B
maxmemory_policy:noeviction
allocator_frag_ratio:1.00
allocator_frag_bytes:200208
allocator_rss_ratio:1.04
allocator_rss_bytes:3784704
rss_overhead_ratio:1.08
rss_overhead_bytes:9023488
mem_fragmentation_ratio:1.12
mem_fragmentation_bytes:13137400
mem_not_counted_for_evict:0
mem_replication_backlog:0
mem_total_replication_buffers:0
mem_clients_slaves:0
mem_clients_normal:1928
mem_cluster_links:0
mem_aof_buffer:0
mem_allocator:jemalloc-5.3.0
active_defrag_running:0
lazyfree_pending_objects:0
lazyfreed_objects:0

@chenyang8094
Copy link
Collaborator

  1. 模拟数据 插入以下结构的大约数据 1万个
    exhset us:126902 session:dea155d63828f002484fb2d67a879c81 "" EX 60
  2. 查看每个数据占用内存情况 (大约152)
    127.0.0.1:6379> memory usage us:105681
    (integer) 152
  3. 但总内存占用 100M
    127.0.0.1:6379> info memory

Memory

used_memory:105388744 used_memory_human:100.51M 问题:按道理算 10000 * 152 = 1.449M 那为什么会占用 100M内存

测试了三种模式,都是占用这么多内存,希望得到回复

Memory

used_memory:105388744 used_memory_human:100.51M used_memory_rss:118505472 used_memory_rss_human:113.02M used_memory_peak:105447208 used_memory_peak_human:100.56M used_memory_peak_perc:99.94% used_memory_overhead:1407072 used_memory_startup:929088 used_memory_dataset:103981672 used_memory_dataset_perc:99.54% allocator_allocated:105497072 allocator_active:105697280 allocator_resident:109481984 total_system_memory:16573603840 total_system_memory_human:15.44G used_memory_lua:31744 used_memory_vm_eval:31744 used_memory_lua_human:31.00K used_memory_scripts_eval:0 number_of_cached_scripts:0 number_of_functions:0 number_of_libraries:0 used_memory_vm_functions:32768 used_memory_vm_total:64512 used_memory_vm_total_human:63.00K used_memory_functions:184 used_memory_scripts:184 used_memory_scripts_human:184B maxmemory:0 maxmemory_human:0B maxmemory_policy:noeviction allocator_frag_ratio:1.00 allocator_frag_bytes:200208 allocator_rss_ratio:1.04 allocator_rss_bytes:3784704 rss_overhead_ratio:1.08 rss_overhead_bytes:9023488 mem_fragmentation_ratio:1.12 mem_fragmentation_bytes:13137400 mem_not_counted_for_evict:0 mem_replication_backlog:0 mem_total_replication_buffers:0 mem_clients_slaves:0 mem_clients_normal:1928 mem_cluster_links:0 mem_aof_buffer:0 mem_allocator:jemalloc-5.3.0 active_defrag_running:0 lazyfree_pending_objects:0 lazyfreed_objects:0

1、请描述下你的redis版本
2、请测试前flushall redis,然后info memory看下内存初始大小,然后在灌入数据后,再次Info memory对比下
3、memory usage只是在算这个tairhash key相关的数据开销,info memory看到的是整个redis进程的内存开销(包括了redis自身元数据、各种Buffer以及内存碎片开销等)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants