OOM Killer Behavior
What is the Linux OOM killer, and how should services be designed around memory pressure?
Answers use simple, clear English.
Audio N/AQuick interview answer
When the kernel cannot reclaim enough memory, it may invoke the OOM killer to terminate processes based on heuristics (oom_score). Design with memory limits, graceful degradation, bounded caches, and health checks. In Kubernetes, set requests/limits and understand QoS classes so critical pods are less likely victims.
Detailed answer
When the kernel cannot reclaim enough memory, it may invoke the OOM killer to terminate processes based on heuristics (oom_score). Design with memory limits, graceful degradation, bounded caches, and health checks. In Kubernetes, set requests/limits and understand QoS classes so critical pods are less likely victims. Userspace should catch allocation failures where possible; not all languages surface them cleanly.
Full explanation
Userspace should catch allocation failures where possible; not all languages surface them cleanly.
Real example & use case
A Java service with an unbounded heap cache gets OOMKilled; fix with cache max size + K8s limits.
Pros & cons
Pros of cgroup limits: blast radius control. Cons: silent kills without good metrics/alerts feel random.