cadvisor错误报告容器内存使用情况 [英] Incorrect reporting of container memory usage by cadvisor
问题描述
cAdvisor报告Prometheus使用的内存为14GB,其中最高报告为6.xGB.
cAdvisor reports 14GB for the memory used by Prometheus where as top reports 6.xGB.
有人可以解释为什么出现这种差异吗?
Can someone explain why this discrepancy?
container_memory_usage_bytes的文档说明为
The documentatation of container_memory_usage_bytes says
Current memory usage in bytes, including all memory regardless of when it was accessed
但是尚不清楚它指的是什么-我假设它是虚拟内存大小?
but it's not clear what this refers to - I assume it's virtual memory size?
据cAdvisor报告:
As reported by cAdvisor:
core@ip-172-20-100-148 ~ $ curl -q localhost:4194/metrics | grep container_memory_usage_bytes | grep prometheus
container_memory_usage_bytes{container_name="prometheus",id="/docker/d37e7503309e632265cb834095efa949da4dc3c72122cb290e626f1121d0ed6b",image="quay.io/prometheus/prometheus:v1.7.1",name="k8s_prometheus.71f5f8c6_prometheus-zwvhx_xx-system_9753de21-aaac-11e7-97e5-026a05f72f78_4682ea0b",namespace="xx-system",pod_name="prometheus-zwvhx"} 1.4178545664e+10
如主机顶部显示的那样:
As reported by top on the host machine:
Tasks: 272 total, 1 running, 271 sleeping, 0 stopped, 0 zombie
%Cpu(s): 20.2 us, 2.7 sy, 0.0 ni, 75.9 id, 0.5 wa, 0.6 hi, 0.1 si, 0.0 st
KiB Mem: 65964640 total, 64892592 used, 1072048 free, 5222520 buffers
KiB Swap: 0 total, 0 used, 0 free. 4737420 cached Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
118446 root 20 0 6783108 6.154g 19864 S 316.7 9.8 8241:05 prometheus
推荐答案
每次讨论此处,cAdvisor将报告总内存使用情况(以字节为单位).
Per the discussion here, cAdvisor reports a total memory usage in bytes.
在您的情况下, cAdvisor 正在报告1.4178545664e+10 Byte = 14.178545664 Gigabyte
.请注意,它是e+10
,所以大约是14G,而不是1.4G.
In your case, cAdvisor was reporting 1.4178545664e+10 Byte = 14.178545664 Gigabyte
. Note it was e+10
so it is approximately 14G, not 1.4G.
这篇关于cadvisor错误报告容器内存使用情况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!