OOM or Out Of Memory is a condition in which the operating system or program cannot receive additional RAM due to the complete exhaustion of free memory.
The OOM condition appears when all memory both physical and RAM as well as the memory in the swap file is completely occupied by the nucleus and programs; and there’s no more memory left.
In most cases, the RAM exhaustion leads to the termination of program performance having made a query for additional RAM; or it may lead to emergency termination of other programs (OOM killer). This termination can damage the stable performance of the system and the integrity of data processing. Oftentimes, the exhaustion of memory leads to a complete server shutdown and requires an emergency reboot.
The main reasons for RAM exhaustion:
- the lack of physical RAM
- high loads (perpetual or at times of heavy traffic)
- settings of the system and server programs that can’t handle such kind of load
- settings of the system and server programs which don’t correspond to the physical server parameters
- memory leaks in programs
How to fight memory exhaustion:
- fine-tune the system components
- increase the volume of the physical memory
- set the specialized OS (e.g. accelerator for the webserver)
- turn off the components that are not being used
- optimize server programs (e.g. website scripts) to use the memory efficiently
- increase the swap file volume (but there is a negative consequence: it leads to a decrease in performance)
- decrease the load (the number of requests) on the server
- migrate some resources to other servers