2017-10-10 142 views
1

cAdvisor報告14GB用於Prometheus使用的內存,其中最高報告爲6.xGB。cadvisor容器內存使用情況報告不正確

有人可以解釋爲什麼這種差異?

container_memory_usage_bytes的documentatation說

Current memory usage in bytes, including all memory regardless of when it was accessed 

,但目前還不清楚這是什麼指的是 - 我想這是虛擬內存的大小?

據報道由cAdvisor:

[email protected] ~ $ 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 

由於主機上報告了頂部:

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 
+0

是的,你是對的,VIRT包括RES。我在我的答案中犯了這個簡單的錯誤。你的容器中是否可以有另一個進程? –

回答

1

每討論here,cAdvisor報告以字節爲單位內存使用情況。

對您的情況,cAdvisor正在報告1.4178545664e+10 Byte = 14.178545664 Gigabyte。注意它是e+10,所以它大約是14G,而不是1.4G。

+0

我認爲VIRT包含RES - 它不?而且,我對普羅米修斯所報道的內存進行了糾正,我已在我的帖子中對其進行了編輯。 –