記一次Redis內存詭異增加

1、現象

  • 實例名:r-bp1cxxxxxxxxxd04(主從)
  • 時間:2017-11-16 12:26~12:27
  • 問題:一分鐘內存上漲了2G,以下圖所示:
  • 鍵值規模:6000萬左右

內存一分鐘增加2G.png

2、Redis內存分析

1.內存組成

上圖中的內存統計的是Redis的info memory命令中的used_memory屬性,例如:redis

redis> info memory
# Memory
used_memory:9195978072
used_memory_human:8.56G
used_memory_rss:9358786560
used_memory_peak:10190212744
used_memory_peak_human:9.49G
used_memory_lua:38912
mem_fragmentation_ratio:1.02
mem_allocator:jemalloc-3.6.0

每一個屬性的詳細說明lua

屬性名 屬性說明
used_memory Redis 分配器分配的內存量,也就是實際存儲數據的內存總量
used_memory_human 以可讀格式返回 Redis 使用的內存總量
used_memory_rss 從操做系統的角度,Redis進程佔用的總物理內存
used_memory_peak 內存分配器分配的最大內存,表明used_memory的歷史峯值
used_memory_peak_human 以可讀的格式顯示內存消耗峯值
used_memory_lua Lua引擎所消耗的內存
mem_fragmentation_ratio used_memory_rss /used_memory比值,表示內存碎片率
mem_allocator Redis 所使用的內存分配器。默認: jemalloc

計算公式以下:spa

相關文章
相關標籤/搜索