OOM Killer Resolutions: Processes with High Risk of Memory Leak
Processes in this group are among the most likely causes of out-of-memory issues. Review the recommendations according to the affected server role and process name.
Load Balancers
When a load-balancer process is terminated, the handled traffic may simply require more memory for normal operation.
| Process | Resolution |
varnishd | Increase the RAM limit for the affected node. |
Java Application Servers
Review the JVM memory settings and adjust them to match the application requirements.
java -Xmx2048m -Xms256m
-Xmx defines the maximum JVM heap size.
-Xms defines the initial heap size.
- Also review
-Xmn when tuning the young-generation heap.
- Remember that a JVM uses additional memory outside the Java heap.
- Review garbage-collector settings when application-specific tuning is required.
| Process | Resolution |
java | Review the xmx, xms, and xmn settings and configure them according to the application’s actual memory requirements. |
PHP Application Servers
For Apache-based PHP servers, inspect the average memory consumed by each httpd process, disable automatic tuning when manual values are required, and reduce the process limits.
(Total_RAM - 5%) / Average_RAM
- Remove the automatic-configuration marker from
/etc/httpd/httpd.conf.
- Use the calculated result to reduce
ServerLimit and MaxClients.
- When memory per process keeps increasing, reduce
MaxRequestsPerChild to approximately 1000–5000.
For NGINX PHP, connect through SSH and inspect the PHP-FPM process sizes using tools such as ps or top.
- If most PHP-FPM processes use about 50–100 MB, disable auto-configuration and reduce
max_children.
- If process sizes vary significantly or exceed about 200–300 MB, inspect the application for a memory leak, optimise the code, or reduce
max_requests_per_child.
| Process | Resolution |
httpd | Check average RAM per process, remove the autoconfiguration marker, and lower ServerLimit and MaxClients using the documented formula. |
httpd.itk | Apply the same Apache memory-management procedure as for httpd. |
lsyncd | Increase node RAM when the application workload requires more memory. |
nginx | Disable automatic configuration and tune the relevant process limits for the application. |
php | Disable automatic configuration and tune the appropriate PHP process settings. |
php-fpm | Disable automatic configuration and tune the appropriate PHP-FPM settings. |
php-fpm7.0 | Disable automatic configuration and tune the appropriate PHP-FPM settings. |
php7.0 | Disable automatic configuration and tune the appropriate PHP settings. |
Ruby Application Servers
Memory leaks are relatively common in Ruby applications. Start by inspecting and optimising the application code. Increasing the node RAM is an alternative when the workload legitimately requires more memory.
| Process | Resolution |
httpd | Check average RAM per process, remove the autoconfiguration marker, and lower ServerLimit and MaxClients. |
httpd.itk | Apply the same Apache tuning procedure. |
bundle | Increase the node RAM when the operation requires additional memory. |
gem | Increase the node RAM when the operation requires additional memory. |
ruby | Inspect and optimise the code or allocate more RAM to the node. |
Python Application Servers
For Apache-based Python servers, use the same httpd process-sizing procedure described for PHP. When another Python process is killed, the application may simply need more RAM.
| Process | Resolution |
httpd | Check RAM per process, remove the autoconfiguration marker, and reduce ServerLimit and MaxClients. |
httpd.itk | Apply the same Apache tuning procedure. |
lsyncd | Increase node RAM when the application requires more memory. |
pip | Check for a stalled network download. Otherwise, allocate more RAM to the node. |
python | Allocate more RAM when the application requires additional memory. |
python2.7 | Allocate more RAM when the application requires additional memory. |
Node.js Application Servers
Restart the container to restore the terminated process. When the issue returns, increase the RAM limit because the application or build operation may require more memory.
| Process | Resolution |
lsyncd | Increase the node RAM. |
grunt | Increase the node RAM. |
node | Increase the node RAM. |
npm | Increase the node RAM. |
phantomjs | Increase the node RAM. |
Database Servers
MySQL
For InnoDB, inspect the current buffer usage:
SHOW ENGINE INNODB STATUS\G;
- If buffers use more than about 80% of the container RAM, reduce
innodb_buffer_pool_size in /etc/my.cnf.
- When buffer usage is not excessive, allocate more RAM.
- Review MySQL logs for warnings and recommendations.
| Process | Resolution |
mysqld | Inspect InnoDB buffers, reduce innodb_buffer_pool_size when necessary, and review MySQL logs. |
httpd | Apply the Apache process-sizing and autoconfiguration procedure. |
PostgreSQL
| Process | Resolution |
postgres | Increase the RAM limit for the database node. |
httpd | Apply the Apache process-sizing and autoconfiguration procedure. |
Redis
| Process | Resolution |
redis-server | Increase the RAM limit for the Redis node. |
Common Processes for Different Stacks
| Process | Stack | Resolution |
httpd | PHP, Ruby, Python, MySQL, PostgreSQL | Check average process RAM, remove the autoconfiguration marker, and reduce ServerLimit and MaxClients. |
lsyncd | PHP, Node.js, Python | Increase node RAM. |
httpd.itk | PHP, Ruby, Python | Apply the Apache memory-tuning procedure. |
procmail | Any | Restart the container. |
vsftpd | Any | Restart the container. |
yum | Any | Restart the container. |
cc1 | Third-party | Increase node RAM. |
clamd | Third-party | Increase node RAM. |
ffmpeg | Third-party | Increase node RAM. |
firefox | Third-party | Increase node RAM. |
newrelic-daemon | Third-party | Restart the primary stack service, such as NGINX, Tomcat, or Node.js. |
Repeated events: Increasing RAM can restore service, but repeated OOM alerts should be followed by code, process, database-buffer, or runtime-configuration analysis.
What’s next?