Advice on setting pod memory request size

11/7/2018

I have a question based on my experience trying to implement memory requests/limits correctly in an OpenShift OKD cluster. I started by setting no request, then watching to see what cluster metrics reported for memory use, then setting something close to that as a request. I ended up with high-memory-pressure nodes, thrashing, and oom kills. I have found I need to set the requests to something closer to the VIRT size in ‘top’ (include the program binary size) to keep performance up. Does this make sense? I'm confused by the asymmetry between request (and apparent need) and reported use in metrics.

-- Steve Huston
kubernetes
openshift

1 Answer

11/8/2018

You always need to leave a bit of memory headroom for overhead an memory spills. If for some reason the container exceeds the memory, either from your application, from your binary of some garbage collection system it will get killed. For example, this is common in Java apps, where you specify a heap and you need an extra overhead for the garbage collector and other things such as:

  • Native JRE
  • Perm / metaspace
  • JIT bytecode
  • JNI
  • NIO
  • Threads

This blog explains some of them.

-- Rico
Source: StackOverflow