cloudfoundry/dea_ng — pull request #89 by sykesm (2013-12-11 21:20:37+00:00)
Title: DEA is reporting incorrect information about memory usage under a warden container

The DEA was reporting 'used_memory_in_bytes' based on what the RSS reported by warden. RSS, however, is not what cgroup uses when checking container memory limits so it's an inappropriate memory statistic to report to end users via cf stats.

The Linux cgroup implementation reports container memory usage in memory/memory.usage_in_bytes and calculates this by [adding][memcontrol] memory/memory.stat:cache and memory/memory.stat:rss so this change will
introduce the same logic to the DEA. Instead of using cache and rss, total_rss and total_cache will be used as it accounts for child containers when present.

With this change, the memory usage reported by `cf stats` and `gcf app` make a whole lot more sense. In the world of java applications, the difference is quite significant. In my case the memory usage reported went from ~80M to ~330M. This helps explain a lot of the problems people run into with memory limits killing their java apps.

[memcontrol]: https://github.com/torvalds/linux/blob/d8fe4acc88da8fbbe360b6592c9d0abbb85117dc/mm/memcontrol.c#L5103-5104