0

My website was suddenly taken down and the root cause was clearly that it ran out of memory, as revealed by the graph below and the logs from /var/log/syslog on the server that I found from the time when the website went down:

enter image description here

Jun  1 14:15:57 mfh-elsalvador kernel: [914994.237820] Out of memory: Killed process 114677 (apache2) total-vm:359436kB, anon-rss:41688kB, file-rss:3100kB, shmem-rss:85448kB, UID:1000 pgtables:480kB oom_score_adj:0
Jun  1 14:15:58 mfh-elsalvador systemd[1]: apache2.service: A process of this unit has been killed by the OOM killer.

This is a WordPress website with Ubuntu and Apache.

This situation had happened to me when I only had 1 GB or RAM on that server. The consumption was at around 80% almost always. Then I thought the problem was that I needed to increase the RAM. I increased it to 2 GB and now it is at around 40% of consumption all the time. I feel that if I increase it to 4 GB the average consumption will be at around 20% or less, but still the website will go down at some point when some process or multiple processes reach the peak of available RAM. I have the feeling that what I really need is not to add RAM, but to attack the root cause from the Apache configurations. What would you recommend in terms of limiting maximum number of requests or memory that a process can consume on Apache, so that I do not have to run out of memory on this server again?

I am thinking that maybe I have to configure MaxRequestWorkers (https://httpd.apache.org/docs/2.4/mod/mpm_common.html), for maximum number of connections that will be processed simultaneously. Or something related to limiting the maximum amount of RAM memory that can be given to a process or request. Any ideas?

4
  • 1
    welcome, since 99% of WordPress questions are related to non business related environmental responsible Persons, we have a specific wordpress stack wordpress.stackexchange.com where you can ask such special questions
    – djdomi
    Commented Jun 3 at 5:35
  • Please edit your question to add all php configuration. A modern php-fpm is quite different from old CGI or mod_php implementations. Also php-fpm has its own process pool and logging that might be useful. Commented Jun 3 at 14:57
  • Did you happen to solve this?
    – themanatuf
    Commented Jun 11 at 16:58
  • @themanatuf Not yet. I am still waiting for the bug to happen again to retrieve logs one more time and follow the instructions from John Mahowald about providing all my PHP configuration. Commented Jun 17 at 22:40

0

You must log in to answer this question.