Hi guys,

i’m having troubles with PHP-FPM.

My droplet:

Dedicated 8 vCPUs
Ubuntu 18.04.3 (LTS) x64

RAM usage - about 10%
CPU usage - about 6%

My application has about 600 online users (on the top usage time). The avarage proccess memory is about 90mB.

My PHP-FPM pool config:

pm = dynamic
pm.maxchildren = 300
servers = 32
pm.minspareservers = 16
pm.maxspareservers = 32
pm.processidletimeout = 5s
pm.max_requests = 1000

process.max = 512 (php-fpm.config)

The problem:

At random times, my application stay very very slow, almost frozed. My log said:

[18-Jan-2021 17:31:26] WARNING: [pool www] seems busy (you may need to increase pm.startservers, or pm.min/maxspare_servers), spawning 16 children, there are 178 idle, and 256 total children

Then, i increase drastically (3x more) (maxchildren, startservers, min/maxspareservers and max_requests), and restartáramos php7.2-fpm service. And then, no changes happen.

So, i return to original parameters (with 20% more then initial) and no effects.

And after 40/50min of slowing, my system returns to normal velocity. And I dont know what causes this.

Does someone can help me?

Thnks since now!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hi @vbrodrigo,

You’ve added the setting pm.maxchildren = 300 however you need to check if your Apache workers and make sure there are at least 300 available.

Basically, the Apache workers are equivalent to a room full of seats. These seats are the projection to your website. When someone opens your website, it’s like one person going to this room and sitting on one of the chairs. When the limit is reached, in order for a person to load your website, another one needs to close it. So basically, I’ll suggest increasing that value as well.

Another thing I would recommend is using pm = static. I remember I had some issues with dynamic previously. Try it out and let me know how it goes please.