Skip to main content

What is an "out of memory" event?

The linux kernel constantly monitors the memory usage of a system. If the usage is reaching a critical threshold, the kernel will issue an "out of memory" routine.

To not endanger the overall system stability, this process will usually terminate the most memory intensive processes at this point in time.

The routine will not stop processes in a coordinated manner. This might have a negative effect to data integrity, for example in the area of database services.

If these "out of memory" events happen regularly, we strongly recommend to upgrade the system memory.

Automated information

We inform you about all "out of memory" events that happen on your system. You will receive a separate information for each process (for example Java, MySQL, PHP). The events of the past 6 hours will be summarized.

Information about often affected processes

As the linux kernels prefers to terminate processes that use a lot of memory, there are some processes affected more often than others:

  • MySQL / Postgres
  • Java
  • User space processes, for example Atlassian software
  • Elasticsearch
  • PHP
  • PHP-FPM as the webserver environment
  • PHP as the CLI environment, for example PHP executed by cronjobs

Please take into consideration that the resource usage of these processes depends on the amount of accesses to your web page or the amount of data processed. In the vast majority the root cause of these "out of memory" events will be found within the application environment.

Show current memory usage

You can get an overview of the memory usage with the following shell command:

www-data@server:~ # ps -eo pid,cmd,%cpu,%mem --sort=-%mem | head -n 11

PID CMD %CPU %MEM
986 /usr/sbin/mysqld --daemoniz 0.1 7.3
125872 ruby2.5 /usr/lib/hello-worl 0.0 2.0
234301 ruby2.5 /usr/lib/find-file- 0.0 1.4
208475 ruby2.5 /usr/lib/find-dir-a 0.0 1.2
310 ruby2.5 /usr/lib/find-dir-b 0.0 1.0
1325 ruby2.5 /usr/lib/find-dir-c 0.0 0.9
125826 ruby2.5 /usr/lib/find-dir-d 0.0 0.9
126039 ruby2.5 /usr/lib/find-dir-e 0.1 0.9
2089 ruby2.5 /usr/lib/find-file- 0.1 0.8
166352 ruby2.5 /usr/lib/exec-comma 0.4 0.7

This will show the 10 processes using the most memory. Please mind that this will be a snapshot of this very moment and depending on the application or service, the memory usage might vary by a significant margin in a short time frame.

Order additional memory

If you need additional memory or have questions about this message, please feel free to contact us: support@nine.ch