I am trying to limit python heap memory inside a k8 pod similar to the way we limit Java heap memory using jvmArgs. I have tried this approach Limit RAM usage to python program, but the python process gets killed even before the memory limit is reached. Any suggestion as to how limit the process memory inside a k8 pod?
Asked
Active
Viewed 613 times
1
-
[Upper memory limit?](https://stackoverflow.com/questions/4285185/upper-memory-limit) suggests the standard Python implementation doesn't have a fixed maximum heap size, the way the JVM does. You can use Kubernetes resource limits to affect when exactly it will run out of memory. – David Maze Sep 09 '20 at 23:39
-
is it managed or standalone k8s? And what are the limits for Pod and "python app" ? When does the Python process killed ? Is there any chance to optimize the app? – Nick Sep 10 '20 at 12:38
-
@DavidMaze but that will just cause k8s killing the pod regularly causing different levels of mess depending on how the code is implemented. That answer means we shall not use Python on k8s ... which is terrible :( – Rafael Mar 13 '22 at 11:44