All Products
Search
Document Center

Managed Service for Prometheus:Why are the memory values obtained in containers inconsistent?

Last Updated:Sep 22, 2025

How memory usage is calculated in the kubectl top pod command

The output of the kubectl top pod command is not equal to the memory usage of the container_memory_usage_bytes metric in Container Service, but the memory usage of the container_memory_working_set_bytes metric. Calculation methods:

  • container_memory_usage_bytes = container_memory_rss + container_memory_cache + kernel memory

  • container_memory_working_set_bytes = container_memory_usage_bytes - total_inactive_file (inactive file pages)

container_memory_working_set_bytes is the actual amount of memory used by the container and is also the basis for restart judgment when a resource limit is configured.