1
0
mirror of https://github.com/docker/cli.git synced 2025-08-01 04:26:55 +03:00

calculateMemUsageUnixNoCache: subtract total_inactive_file, not cache

The new stat definition corresponds to containerd/CRI and cadvisor.

c1115d4e57/pkg/server/container_stats_list_unix.go (L106-L129)
307d1b1cb3

Fix https://github.com/moby/moby/issues/40727

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
Akihiro Suda
2020-04-03 14:33:43 +09:00
parent 84c23a6ddf
commit a4a07c6430
3 changed files with 25 additions and 4 deletions

View File

@ -25,7 +25,10 @@ The `docker stats` command returns a live data stream for running containers. To
If you want more detailed information about a container's resource usage, use the `/containers/(id)/stats` API endpoint.
> **Note**: On Linux, the Docker CLI reports memory usage by subtracting page cache usage from the total memory usage. The API does not perform such a calculation but rather provides the total memory usage and the amount from the page cache so that clients can use the data as needed.
> **Note**: On Linux, the Docker CLI reports memory usage by subtracting cache usage from the total memory usage. The API does not perform such a calculation but rather provides the total memory usage and the amount from the cache so that clients can use the data as needed.
The cache usage is defined as the value of `total_inactive_file` field in the `memory.stat` file on cgroup v1 hosts.
On Docker 19.03 and older, the cache usage was defined as the value of `cache` field.
On cgroup v2 hosts, the cache usage is defined as the value of `inactive_file` field.
> **Note**: The `PIDS` column contains the number of processes and kernel threads created by that container. Threads is the term used by Linux kernel. Other equivalent terms are "lightweight process" or "kernel task", etc. A large number in the `PIDS` column combined with a small number of processes (as reported by `ps` or `top`) may indicate that something in the container is creating many threads.