Difference between cAdvisor memory report and resources maxrss in python

6/30/2017

I'm running a simple flask web app using kubernetes as infrastructure. Recently I realized a curious behavior, when I was testing memory consumption. Using the following python code I report the total RSS used by my process.

resource.getrusage(resource.RUSAGE_SELF).ru_maxrss

After some warmup making requests to the server the reported resident memory was about 128Mb.

cAdvisor on the other hand reported 102Mib of rss. If it was the opposite there would be some sense in it, since the container could be using some memory for other stuff beside running my app, but the weird thing is that the python process apparently is using more memory than the container is aware of.

Making the conversion from Mib to Mb does not explain that since 102Mib ~ 107Mb.

What does the memory usage reported by cAdvisor stands for? Which number should I use as a reliable memory usage report?

-- Felipe Jun
cadvisor
kubernetes
memory
memory-management
python

0 Answers