B
B
betal2016-01-26 01:33:26
PHP
betal, 2016-01-26 01:33:26

High la and system cpu on php-fpm?

Previously, I had PHP7 (FPM) installed, it works in a separate /opt/ folder.
But in production, I ran into the problem of high System CPU usage (~ 97%), under load. It doesn't seem like much of a load though. offhand 10-15 RPS. User CPU is 2-3%, IO(wa) ~ 0.5%, sy 97%. free RAM >
8GB it works, runs in 5 - 15 worker processes with ~4% user cpu, ~2% sy, 94%id
then abruptly over time (10 minutes - 120 minutes depending on the load) la grows from 4 to more than 200, the number of php processes tends to the maximum (I tried both limiting and not limiting their number, it doesn’t change the essence). It seems that it worked on php5.6, but with php7 offhand it became faster by 25 percent, i.e. there seem to be enough resources. At least until it goes into regression, there are a lot of CPU, RAM, IO.
I suspect that this may be due to the file socket to which nginx connects, I tried to run php through strace, many calls to sendto, recvfrom.
Tried increasing parameters
net.core.wmem_default = 4194394
net.core.rmem_default = 8388608
net.core.netdev_max_backlog=10000
net.core.somaxconn=4096
net.core.rmem_max=16777216
net.core.wmem_max=16777216
The number of php processes is in the speaker, I tried to set it in the range of 80 (it goes to system cpu -> 100% quickly),
I tried to set it to 800, it also goes away quickly, if you set it around 240 then goes into regression within an hour.
It seems that after working out the process does not die and their number accumulates and gradually grows, and after a certain amount the system cpu increases sharply.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
alex1442, 2016-01-26
@alex1442

look at the progress of the request in xdebug,
find the bottlenecks

D
Denis, 2016-01-26
@prototype_denis

Возможно вам поможет эта ссылка
askubuntu.com/questions/393067/php-fpm-eating-memo...
Но как посоветовали до меня - надо искать узкие места.
По крайней мере для начала настройте fpm так, что бы дочерние процессы создавались только для обработки запросов, а не висели в памяти в энном количестве в режиме ожидания.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question