[英]What is the difference between “container_memory_working_set_bytes” and “container_memory_rss” metric on the container
[英]PromQL difference between memory usage and working set
我正在嘗試確定一段時間內容器的平均使用量 memory
下面是我在 OpenShift 4.9 中使用的查詢
sum by (namespace, pod) (avg_over_time(pod:container_memory_usage_bytes:sum[2d]))
上面的查詢在 4.11 版本的 OpenShift 中不起作用,所以我嘗試修改上面的查詢
sum by (namespace, pod) (avg_over_time(node_namespace_pod_container:container_memory_working_set_bytes{}[2h])/1048576)
兩個查詢都提供不同的值,但有細微差別。
我對使用上述 2 中的哪個查詢來確定 POD 使用的平均 memory 感到困惑。
PromQL 中memory usage和working set的區別在於,memory usage 是指分配給進程的 memory 的總量,而 working set 是進程正在使用的 memory 的總量。 Memory usage 包括active 和 inactive memory ,而 working set 只包括正在被 active使用的 memory。 換句話說,工作集是 memory 用法的一個子集。
以下表達式可用於匯總兩天內命名空間和 pod 的平均 pod 容器 memory 使用情況:
sum by (namespace, pod) (avg_over_time(pod:container_memory_usage_bytes:sum[2d]))
建議使用以下查詢,因為 memory_working_set 將給出 memory 的使用情況,該地址已被積極使用。
sum by (namespace, pod) (avg_over_time(node_namespace_pod_container:container_memory_working_set_bytes{}[2h])/1048576)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.