• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue Apache's memory behaviour + stability

Olaf Kapinski

New Pleskian
My Plesk is not stabile: Every other day nginx and/or Apache Service has to be restarted by Watchdog. System is ‪Ubuntu 18.04.1 LTS with Plesk Onyx Version 17.8.11 Update #31 on 6core, 12MB .

I now investigate on the Apache Memory-Usage, which goes up and falls down, see picture. In “top” I see several php-fpm-Processes, the user “userok” suggests, it’s my Podcast-Website.

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
18243 userok 20 0 1721064 1,136g 44020 S 46,8 9,5 43:05.72 php-fpm
18294 userok 20 0 1704548 1,119g 43400 S 0,0 9,3 42:32.56 php-fpm
18334 userok 20 0 1697968 1,112g 43176 S 0,0 9,3 41:57.22 php-fpm
18407 userok 20 0 1696372 1,112g 43828 S 0,0 9,3 43:22.58 php-fpm
1478 root 20 0 1619468 20604 3020 S 1,3 0,2 41:47.64 fail2ban-server
19508 userok 20 0 1530572 996980 41112 S 0,0 7,9 37:14.47 php-fpm
2525 mysql 20 0 1006104 381760 7544 S 4,0 3,0 316:07.59 mysqld
364 root 20 0 960864 5796 3360 S 0,0 0,0 3:49.34 sw-collectd

I Don’t understand, why this Site consumes soooo much memory, if I interpret the numbers correctly, this Website takes nearly half the Server memory! In the php.ini I’ve given it 256MB (it’s a WordPress), why does it use 5,5GB RAM? The Analytics says, there where not 100 Users on the Site today.

Appreciate any Info or pointing in a dirction that could help.

Thanks a lot!
OLAF
 

Attachments

  • load.png
    load.png
    26.9 KB · Views: 0
The PHP setting of 256 MB only means that the single instance that is momentarily used by a single request is allowed to reserve 256 MB RAM. But normally, there are 10, maybe 20 such processes at the same time, meaning that 20 x 256 MB or even more will be reserved in RAM.

What you should look at is whether you have set PHP-FPM to "ondemand" method, not "dynamic" or "static". If it is already set to "ondemand", check the pm.process_idle_timeout value in the PHP-FPM configuration file of the site. It should be short, e.g. less than 10 seconds, so that children will be removed from RAM once they have completed their task. If that does not help, it is possible that your site simply needs much RAM.
 
Good Morning and thanks for replying!

The PHP setting of 256 MB only means that the single instance that is momentarily used by a single request is allowed to reserve 256 MB RAM. But normally, there are 10, maybe 20 such processes at the same time, meaning that 20 x 256 MB or even more will be reserved in RAM.

Okay, I think, I understand that. Any Idea what happens on this Website when the Analytics says, there are only very few visitors but it still ocupies 4+GB RAM? This is what I don't get. As I write this, the System looks normal: That particular Website uses maybe 500MB. What's going on there???

What you should look at is whether you have set PHP-FPM to "ondemand" method, not "dynamic" or "static". If it is already set to "ondemand", check the pm.process_idle_timeout value in the PHP-FPM configuration file of the site. It should be short, e.g. less than 10 seconds, so that children will be removed from RAM once they have completed their task. If that does not help, it is possible that your site simply needs much RAM.

I thought about this, now I changed it. Not really to save memory, but to try to get this damn server stabile, behaves like NT4. I have some concerns, that this impacts the performance of the Websites, bt let's see, what happens over the day

Thanks a lot!
OLAF
 
Correction: Back to "dynamic", as the Websites where not working any more, once changed to ondemand :( These where the settings:
pm = ondemand
pm.max_children = 5
;pm.start_servers = 2
;pm.min_spare_servers = 1
;pm.max_spare_servers = 3
pm.process_idle_timeout = 10s;
pm.max_requests = 500
Damn
 
Back
Top