redis Version: 5.0.5
info memory
used_memory:22206234104 used_memory_human:20.68G used_memory_rss:28291768320 used_memory_rss_human:26.35G used_memory_peak:22356496552 used_memory_peak_human:20.82G used_memory_peak_perc:99.33% mem_fragmentation_ratio:1.27 mem_fragmentation_bytes:6085614704 mem_allocator:jemalloc-5.1.0 active_defrag_running:50
activedefrag
127.0.0.1:6381> config get active* 1) "active-defrag-threshold-lower" 2) "1" 3) "active-defrag-threshold-upper" 4) "100" 5) "active-defrag-ignore-bytes" 6) "104857600" 7) "active-defrag-cycle-min" 8) "50" 9) "active-defrag-cycle-max" 10) "75" 11) "active-defrag-max-scan-fields" 12) "1000" 13) "activerehashing" 14) "yes" 15) "activedefrag" 16) "yes"
Persistence
loading:0 rdb_changes_since_last_save:1608866 rdb_bgsave_in_progress:0 rdb_last_save_time:1735387232 rdb_last_bgsave_status:ok rdb_last_bgsave_time_sec:144 rdb_current_bgsave_time_sec:-1 rdb_last_cow_size:3083444224 aof_enabled:0 aof_rewrite_in_progress:0 aof_rewrite_scheduled:0 aof_last_rewrite_time_sec:-1 aof_current_rewrite_time_sec:-1 aof_last_bgrewrite_status:ok aof_last_write_status:ok aof_last_cow_size:0
RDB
127.0.0.1:6381> config get save 1) "save" 2) "900 20 300 200 60 200000"
memory fragment bytes
how to reduce mem_fragmentation_bytes without restart redis server [抱拳]
Comment From: sundb
@WYmindsky can you share the output or memory malloc-stats?
Comment From: WYmindsky
@WYmindsky can you share the output or
memory malloc-stats?
127.0.0.1:6381> MEMORY MALLOC-STATS ___ Begin jemalloc statistics ___ Version: "5.1.0-0-g0" Build-time option settings config.cache_oblivious: true config.debug: false config.fill: true config.lazy_lock: false config.malloc_conf: "" config.prof: false config.prof_libgcc: false config.prof_libunwind: false config.stats: true config.utrace: false config.xmalloc: false Run-time option settings opt.abort: false opt.abort_conf: false opt.retain: true opt.dss: "secondary" opt.narenas: 64 opt.percpu_arena: "disabled" opt.metadata_thp: "disabled" opt.background_thread: false (background_thread: false) opt.dirty_decay_ms: 10000 (arenas.dirty_decay_ms: 10000) opt.muzzy_decay_ms: 10000 (arenas.muzzy_decay_ms: 10000) opt.junk: "false" opt.zero: false opt.tcache: true opt.lg_tcache_max: 15 opt.thp: "default" opt.stats_print: false opt.stats_print_opts: "" Arenas: 64 Quantum size: 8 Page size: 4096 Maximum thread-cached size class: 32768 Number of bin size classes: 39 Number of thread-cache bin size classes: 44 Number of large size classes: 196 Allocated: 22503004512, active: 22773538816, metadata: 375228664 (n_thp 0), resident: 23150522368, mapped: 23177973760, retained: 16524783616 Background threads: 0, num_runs: 0, run_interval: 0 ns n_lock_ops n_waiting n_spin_acq n_owner_switch total_wait_ns max_wait_ns max_n_thds background_thread 12579935 0 0 1 0 0 0 ctl 25156513 0 0 1 0 0 0 prof 0 0 0 0 0 0 0 arenas[0]: assigned threads: 1 uptime: 655261217168821 dss allocation precedence: "secondary" decaying: time npages sweeps madvises purged dirty: 10000 435 1114216 6070651 99014707 muzzy: 10000 0 1772625 5040298 76952135 allocated nmalloc ndalloc nrequests small: 19973744992 5859178650 5661522507729343345219 large: 2529259520 145848364 145783060 145848364 total: 22503004512 6005027014 5807305567729489193583
active: 22773538816 mapped: 23177973760 retained: 16524783616 base: 375195888 internal: 32776 metadata_thp: 0 tcache_bytes: 19536 resident: 23150522368 n_lock_ops n_waiting n_spin_acq n_owner_switch total_wait_ns max_wait_ns max_n_thds large 15460435 0 0 1 0 0 0 extent_avail 58171167 0 0 3 0 0 0 extents_dirty 358736023 0 0 3 0 0 0 extents_muzzy 30074000 0 0 3 0 0 0 extents_retained 32674161 0 0 3 0 0 0 decay_dirty 16442726 0 0 1 0 0 0 decay_muzzy 17101135 0 0 1 0 0 0 base 14927670 0 0 3 0 0 0 tcache_list 6291644 0 0 1 0 0 0 bins: size ind allocated nmalloc ndalloc nrequests curregs curslabs regs pgs util nfills nflushes nslabs nreslabs n_lock_ops n_waitingn_spin_acq n_owner_switch total_wait_ns max_wait_ns max_n_thds 8 0 229251136 185044741 156388349 22620325898 28656392 55971512 1 0.999 103160523 47327672 111993 112078261 22035964416 0 0 13144519 0 0 0 16 1 176928160 528113915 517055905 42984420910 11058010 43207256 1 0.999 264073801 71933301 87472 275562575 10025836433 0 0 13471803 0 0 0 24 2 1647677280 643428726 574775506 28413197085 68653220 134130512 3 0.999 232557255 70974420 265612 167650829 63098900691 0 0 95172825 0 0 0 32 3 465923104 1348679646 1334119549 255497114492 14560097 113814128 1 0.999 624991608 80867322 232273 710843246 12524909795 0 0 32742271 0 0 0 40 4 853254160 236895613 215564259 77602306355 21331354 41676512 5 0.999 102314338 66575495 82394 139284600 19414388378 0 0 39211743 0 0 0 48 5 572567088 221813173 209884692 47378858518 11928481 46614256 3 0.999 98471234 57167563 95988 145208051 10814539658 0 0 36975871 0 0 0 56 6 368847248 927219937 920633379 171499423115 6586558 12870512 7 0.999 484591468 79191736 26756 739299595 6336653735 0 0 23388485 0 0 0 64 7 165193216 313213972 310632828 39913080695 2581144 40346 64 1 0.999 191555123 67444587 86975 250298856 2209196952 0 0 12051009 0 0 0 80 8 215475040 103216660 100523222 14515062235 2693438 10523256 5 0.999 56695566 53984949 25206 87833302 2554354334 0 0 8629453 0 0 0 96 9 96166080 75396493 74394763 10881414405 1001730 7860128 3 0.995 46000630 46944606 23936 64404866 994836509 0 0 7353375 0 0 0 112 10 10529008 25882045 25788036 1497705744 94009 369256 7 0.995 15567556 18334064 1379 18687670 130312086 0 0 6086051 0 0 0 128 11 6689408 43621046 43568785 191569107 52261 1636 32 1 0.998 36100588 37532260 16406 23976371 135302186 0 0 6956239 0 0 0 160 12 42389440 103360363 103095429 8305857871 264934 2071128 5 0.999 55372723 61324784 10858 98611159 382293800 0 0 7541503 0 0 0 192 13 14041920 65005412 64932277 540952928 73135 1144 64 3 0.998 45612901 47957278 10415 42989412 172776079 0 0 6643789 0 0 0 224 14 30623712 86505219 86368506 1292585684 136713 1070128 7 0.998 47505955 54970165 6513 79803100 249395584 0 0 8081931 0 0 0 256 15 38868224 78697197 78545368 1069182571 151829 9512 16 1 0.997 49229485 52778887 40696 79424494 262627711 0 0 7099279 0 0 0 320 16 166578240 82705672 82185115 1548214711 520557 8135 64 5 0.999 49490863 48693082 29790 80061790 616336579 0 0 8260597 0 0 0 384 17 3082257024 147400609 139373898 206368755 8026711 250840 32 3 0.999 100009357 5924130 1088431 22442038 7546781686 0 0 7831893 0 0 0 448 18 6573315840 263994745 249322165 340335105 14672580 229264 64 7 0.999 174345382 6067937 947194 25570065 13799657730 0 0 12886981 0 0 0 512 19 805368320 25953229 24380244 33954627 1572985 196627 8 1 0.999 17593373 3844702 711882 12217967 1425024650 0 0 4661069 0 0 0 640 20 988281600 34765370 33221180 86529674 1544190 48264 32 5 0.999 26365524 26219282 154332 14508542 1594804637 0 0 6221335 0 0 0 768 21 166907904 48115583 47898255 209253397 217328 13592 16 3 0.999 37103814 37571903 73668 34913882 294890710 0 0 6389343 0 0 0 896 22 17167360 65800260 65781100 640223982 19160 600 32 7 0.997 45614689 49111886 27949 31768709 120162569 0 0 6365281 0 0 0 1024 23 228226048 58445450 58222573 328408575 222877 55721 4 1 0.999 42246824 44312546 1003571 42904030 320349907 0 0 6465001 0 0 0 1280 24 317465600 68645135 68397115 738963477 248020 15502 16 5 0.999 46019855 49904086 236746 43015496 348289926 0 0 6505943 0 0 0 1536 25 697039872 64417547 63963745 989665807 453802 56727 8 3 0.999 43268893 47732369 622151 44320907 548104056 0 0 6457023 0 0 0 1792 26 498176 3941786 3941508 7053450 278 18 16 7 0.965 3719443 3689847 25291 3644 14030534 0 0 513303 0 0 0 2048 27 99563520 916131 867516 869704 48615 24308 2 1 0.999 750604 762559 432737 25016 56645221 0 0 3534233 0 0 0 2560 28 18298880 29485 22337 341284 7148 894 8 5 0.999 17872 16724 3415 366 13436355 0 0 1826721 0 0 0 3072 29 3892224 41759 40492 49865 1267 317 4 3 0.999 38712 39903 1461 187 7635350 0 0 1690399 0 0 0 3584 30 30883328 66772 58155 155906 8617 1078 8 7 0.999 35700 41579 7280 7781 14983333 0 0 3179693 0 0 0 4096 31 159109120 592421 553576 447054 38845 38845 1 1 1 289608 411875 592421 0 49055851 0 0 3417765 0 0 0 5120 32 56796160 3959600 3948507 5568265 11093 2774 4 5 0.999 3925371 3931839 13053 3677 25225431 0 0 4284517 0 0 0 6144 33 25583616 1479598 1475434 1532751 4164 2083 2 3 0.999 1466979 1470339 947736 3673 15249517 0 0 3150491 0 0 0 7168 34 1195844608 1160585 993754 1910921 166831 41711 4 7 0.999 780973 761831 109289 315685 172109794 0 0 3467175 0 0 0 8192 35 332161024 619308 578761 396714 40547 40547 1 2 1 391899 510397 619308 0 42755140 0 0 3294059 0 0 0 10240 36 73379840 32705 25539 43019 7166 3583 2 5 1 13617 18343 16352 1380 13498432 0 0 3134451 0 0 0 12288 37 688128 709 653 537 56 56 1 3 1 447 614 709 0 6339183 0 0 89191 0 0 0 14336 38 14336 33 32 26 1 1 2 7 0.500 23 25 7 1 6292700 0 0 1993 0 0 0 large: size ind allocated nmalloc ndalloc nrequests curlextents 16384 39 65536 370 366 439 4 20480 40 1318952960 19485481 19421079 52272628 64402 24576 41 7446528 419562 419259 436331 303 28672 42 888832 50571 50540 51014 31 32768 43 5931008 348021 347840 378472 181 40960 44 14950400 125458475 125458110 125458475 365 49152 45 0 13 13 13 0 57344 46 229376 14414 14410 14414 4 65536 47 196608 120 117 120 3 81920 48 163840 53871 53869 53871 2 98304 49 98304 17409 17408 17409 1 114688 50 0 18 18 18 0 131072 51 0 9 9 9 0 163840 52 163840 12 11 12 1 196608 53 0 5 5 5 0 --- 262144 55 262144 1 0 1 1 --- 393216 57 0 1 1 1 0 --- 655360 60 1310720 2 0 2 2 --- 917504 62 0 1 1 1 0 --- 2621440 68 0 1 1 1 0 --- 4194304 71 4194304 2 1 2 1 --- 33554432 83 33554432 2 1 2 1 --- 67108864 87 67108864 2 1 2 1 --- 1073741824 103 1073741824 1 0 1 1 --- --- End jemalloc statistics ---
Comment From: sundb
@WYmindsky the fragmentation is really low from your output, util are almost 0.999 or 1.
mem_fragmentation_bytes doesn't only fragmentaion, it's the ratio of used memory to RSS.
btw: mem_fragmentation_bytes was replaced by allocator_frag_bytes in the new version.
Comment From: WYmindsky
@WYmindsky the fragmentation is really low from your output,
utilare almost 0.999 or 1.mem_fragmentation_bytesdoesn't only fragmentaion, it's the ratio of used memory to RSS. btw:mem_fragmentation_byteswas replaced byallocator_frag_bytesin the new version.
actually, the container memory is: 26G = used_memory + mem_fragmentation_bytes
when the container reach momery limit 30G, it will reboot, it has been reboot many times
my redis version is 5.0.5
From which aspects can I reclaim these memory fragments, business or vm machine or redis.conf, tks
Comment From: sundb
@WYmindsky You can try memory pruge to see if it works.