S
S
Stanislav2016-05-25 09:23:17
PHP
Stanislav, 2016-05-25 09:23:17

How to solve the problem of hanging httpd daemons?

OS Centos 7
httpd (apache2) running in prefork mode. There is also a mod_ruid2 module to distinguish between virtual hosts for different users, the config is as follows:

LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

<IfModule prefork.c>
    StartServers          3
    MinSpareServers       3
    MaxSpareServers        10
    ServerLimit            32
    MaxClients             32
    MaxRequestsPerChild    50
</IfModule>

There is a heavy site that spends a lot of memory and CPU time on caching. After some time, I see the following picture in htop:
92131354cd9040018974671fb537a7bd.png
I believe that something is hanging on this site and is not releasing resources.
As one of the solutions, I suggested that I reduce the value of MaxRequestsPerChild to 50, it used to be 1000, before the site was transferred, there were no problems. But it didn't help.
I set a limit on CPU consumption to avoid overloading the server with RLimitCPU 40, but now the number of hung httpd processes has simply increased.
How to catch the reason for eating resources and why they are not released from the server side? Is there any solution that from the side of the server configuration will be safe to restart the httpd process after a certain time elapses, i.e. prevent freezing for more than 2-3 hours, for example?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
Puma Thailand, 2016-05-25
@delfi

this is the cpu and not the memory, he can’t release it, if something thinks it’s
logical that you broke the caching on the site, most likely
, you can profile it with the same xhprof

X
xmoonlight, 2016-05-25
@xmoonlight

php.net/manual/ru/function.set-time-limit.php
UPD: onedev.net/post/502

O
Oleg Wock, 2015-08-18
@kirill-93

Try writing a log, maybe the script is running, but it crashes
I also had a problem (albeit on debian) that the script is automatically launched using /bin/sh (which is linked from the box to dash, not bash) and as a result the script did not see the environment variables and crashed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question