<p>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.</p>

<p>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:</p>

<ul>
<li>Native JRE</li>
<li>Perm / metaspace</li>
<li>JIT bytecode</li>
<li>JNI</li>
<li>NIO</li>
<li>Threads</li>
</ul>

<p><a href="https://jaxenter.com/nobody-puts-java-container-139373.html" rel="nofollow noreferrer">This blog</a> explains some of them.</p>
