Pod命令如何計算記憶體使用量量
執行kubectl top pod命令得到的結果,並不是Container Service中container_memory_usage_bytes指標的記憶體使用量量,而是指標container_memory_working_set_bytes的記憶體使用量量,計算方法如下:
container_memory_usage_bytes = container_memory_rss + container_memory_cache + kernel memory
container_memory_working_set_bytes = container_memory_usage_bytes - total_inactive_file(不活躍檔案頁)
container_memory_working_set_bytes是容器真實使用的記憶體量,也是資源限制limit時的重啟判斷依據。