Skip to content

Docker stats memory usage is misleading #10824

Closed
@SamSaffron

Description

@SamSaffron
# free -h
             total       used       free     shared    buffers     cached
Mem:          2.0G       1.9G        95M       273M        97M       879M
-/+ buffers/cache:       930M       1.0G
Swap:         1.0G        15M       1.0G
# docker stats app
CONTAINER           CPU %               MEM USAGE/LIMIT       MEM %               NET I/O
app                 51.20%              1.311 GiB/1.955 GiB   67.06%              58.48 MiB/729.5 MiB

so I have 1GB of RAM to play with yet docker stats is reporting 1.3G used on a 2G system, so its reporting pages that are used for disk caching as well as used, which it "technically" used but will be freed by the OS once we run low on RAM

Instead stat should just report (used - buffers cached) and (buffers cached in brackets)

Otherwise people using this information may be mislead as to how bad stuff really is ( http://www.linuxatemyram.com/ )

Also recommend using standard unix postfixes here, so it 1.311G not 1.311 GiB

cc @crosbymichael

Activity

crosbymichael

crosbymichael commented on Feb 23, 2015

@crosbymichael
Contributor

+1 I think it would make sense to make this change.

blackfader

blackfader commented on Feb 26, 2015

@blackfader

yes memory is not right

added
kind/enhancementEnhancements are not bugs or new features but can improve usability or performance.
and removed on Feb 26, 2015
added
kind/enhancementEnhancements are not bugs or new features but can improve usability or performance.
and removed
kind/enhancementEnhancements are not bugs or new features but can improve usability or performance.
on Mar 21, 2015
mattva01

mattva01 commented on Mar 22, 2015

@mattva01

@spf13
This is a little harder then it seems, as it requires modifying libcontainer code here: https://github.com/docker/libcontainer/blob/master/cgroups/fs/memory.go
Do we use memory.stat.rss, memory.stat.usage_in_bytes - memory.stat.cache, or some other combination of stats...?

jessfraz

jessfraz commented on Mar 22, 2015

@jessfraz
Contributor

I switched to the proficient label

On Sunday, March 22, 2015, Matthew Gallagher notifications@github.com
wrote:

@spf13 https://github.com/spf13
This is a little harder then it seems, as it requires modifying
libcontainer code here:
https://github.com/docker/libcontainer/blob/master/cgroups/fs/memory.go
Do we use memory.stat.rss, memory.stat.usage_in_bytes - memory.stat.cache,
or some other combination of stats...?


Reply to this email directly or view it on GitHub
#10824 (comment).

imleon

imleon commented on Mar 23, 2015

@imleon

Try set the param of docker run --memory,then check your
/sys/fs/cgroup/memory/docker/<container_id>/memory.usage_in_bytes
It should be right.

69 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    exp/intermediatekind/enhancementEnhancements are not bugs or new features but can improve usability or performance.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @farcaller@SamSaffron@spf13@imleon@akailash

      Issue actions

        Docker stats memory usage is misleading · Issue #10824 · moby/moby