Re: Memory usage: number reported from `cf app <app>` vs. inside container
Julz Friedman
Hi John,
toggle quoted message
Show quoted text
Unfortunately memory usage inside containers is a bit of a painful topic. I've linked to a really great blog by Heroku on this topic below that goes in to more detail but tl;dr there's not a great answer to your question right now. Memory in the container is constrained by cgroups; things like /proc/meminfo report based on the host rather than the cgroup and aren't containerised. If you're an operator and are on the host you can easily check the numbers by finding your container's cgroup directory under /sys/fs/cgroup/memory/ and just reading the files in that directory (e.g. memory.stat, memory.usage_in_bytes etc). Unfortunately we don't allow you to mount cgroups in the container so you can't see this via cf ssh. When cgroups namespaces are added to the kernel we may be able to change this but right now the cgroup hierarchy is global so we don't want to expose it in containers. Just to be clear though, what you see in the metrics cloud foundry reports is identically the numbers from the host's cgroup hierarchy, so the only way they can be wrong is if there's a kernel bug (in which case you'd see the same numbers via cf ssh anyway). Garden never kills your app itself for being out of memory, it just places it in a cgroup with a limit and tells the kernel to kill it if it's exceeded. Hope this was at least somewhat helpful! [0]: https://fabiokung.com/2014/03/13/memory-inside-linux-containers/ On Mon, 31 Oct 2016 at 15:46, John Feminella <jxf(a)pivotal.io> wrote:
If I `cf ssh` into a (garden-runc) container, what can I run to convince |
|