Linux's OOM (Out Of Memory) killer, is a mechanism that the Linux kernel employs when the system is critically low on memory. When your system runs out of memory, it is the job of the Linux OOM killer to sacrifice one or more processes in order to free up memory for the system when all else fails.
How do I Determine if OOM Killer is Responsible for a Process Being Killed?
You can run this command to see if a service/process has been killed by OOM killer. You would replace MySQL with the name of the service/process you want to check.
grep -Ei "(out of memory|oom)" /var/log/messages* -A 1 | grep -i mysql
Please note that different operating systems have different logging formats. The best way to review the system log files (/var/log/messages OR journalctl) is to directly search for the strings "oom" or "out of memory" and compare the timestamp with the time that the associated service was reported to fail.
What Is The Solution?
The solution will change depending on what is using the most memory. This may require you to reduce memory usage or increase available RAM on the system. Common solutions include:
- Limit the memory that can be used by PHP ( memory_limit)
How to set or increase PHP INI memory_limit or other values?
- Reduce the number of requests Apache can serve at once
Tuning MaxRequestWorkers for Apache