gpt4 book ai didi

普罗米修斯 (Docker) : determine available memory per node (which metric is correct?)

转载 作者:行者123 更新时间:2023-12-03 17:00:23 24 4
gpt4 key购买 nike

我们一直在努力为运行 Docker 组件的节点创建良好的内存监控。我们将 Prometheus 与 cadvisor 和 node_exporter 结合使用。

确定每个节点已用内存的最佳方法是什么?

方法一 :在我们的例子中给出了大约 42%

(1-(node_memory_MemAvailable_bytes/node_memory_MemTotal_bytes))*100

方法二 : 大约 80%
(1-((node_memory_MemFree_bytes+node_memory_Buffers_bytes+node_memory_Cached_bytes)/node_memory_MemTotal_bytes))*100

Q2:为什么会有这种差异?我能从中学到什么?

因此,我对确定的各个指标进行了更深入的研究:
  • 可用内存 : 在我们的实验中大约是 5%

    (node_memory_MemFree_bytes/node_memory_MemTotal_bytes)*100
  • 缓冲内存 : 约 0.002%

    (node_memory_Buffers_bytes/node_memory_MemTotal_bytes)*100
  • 缓存内存 : 约 15%

    (node_memory_Cached_bytes/node_memory_MemTotal_bytes)*100
  • 可用内存 : 58%

    (node_memory_MemAvailable_bytes/node_memory_MemTotal_bytes)*100

  • 我希望 FreeMem + BufferedMem + CachedMem 会围绕 AvailableMem。但这不是这个简单实验的结果。

    Q3:为什么这不是真的?

    据说Linux上的空闲内存由free mem + buffered mem + cached mem组成。当内存不足时,可以释放缓存的内存等。

    最佳答案

    本文档详细说明了这些数字的含义:
    https://github.com/torvalds/linux/blob/master/Documentation/filesystems/proc.rst#meminfo

    MemAvailable:An estimate of how much memory is available for starting new applications, without swapping. Calculated from MemFree, SReclaimable, the size of the file LRU lists, and the low watermarks in each zone. The estimate takes into account that the system needs some page cache to function well, and that not all reclaimable slab will be reclaimable, due to items being in use. The impact of those factors will vary from system to system.


    所以 MemAvailable 是估计可以使用多少内存而无需交换 用于新进程。 FreeMem 只是计算到 MemAvailable 中的一部分。 BufferedMem 和 CachedMem 可能会被考虑在内,但这些只是可能被回收的一小部分内存:

    Buffers:Relatively temporary storage for raw disk blocks shouldn't get tremendously large (20MB or so)


    Cached:in-memory cache for files read from the disk (the pagecache). Doesn't include SwapCached

    关于普罗米修斯 (Docker) : determine available memory per node (which metric is correct?),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61751232/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com