# PHP-FPM and nginx starting to have troubles



## stratacast1 (Feb 13, 2018)

So just out of nowhere, I found that my Nextcloud instance was running REALLY slow. The webpage is basically inaccessible. I eventually get a timeout and a 502 error, and looking at the logs, it looks like php-fpm is to blame, but I can't understand why all of a sudden it would run out of server and children processes when there are barely any connections happening at a given time. Here is the error that comes up when a connection is trying to be processed:



```
[12-Feb-2018 19:13:59] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 0 idle, and 16 total children
[12-Feb-2018 19:14:00] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 16 children, there are 0 idle, and 18 total children
[12-Feb-2018 19:14:01] WARNING: [pool www] server reached pm.max_children setting (20), consider raising it
```

Could there be a php bug maybe? I don't know where to begin to look to understand why there is a need to spin up so many threads and still have a failed connection.

This is FreeBSD 11.1, in an iocage jail on a mirrored zfs pool


----------



## stratacast1 (Feb 13, 2018)

Huh...well, not sure what happened but it turns out the problem was a Nextcloud issue surprisingly. I upgraded from version 12 to 13 and all is well now!


----------



## PacketMan (Feb 13, 2018)

I am curious if your memory or cpu utilization changed during then?


----------



## tingo (Feb 14, 2018)

Remember: web servers (apache, nginx are the ones I have tried) and their script languages (php, mostly) often have default settings designed to automatically scale up with traffic. This isn't necessarily what you want on a small test server with limited resources. If your server starts to swap or run out of some other resource, you will find out sooner or later.


----------



## stratacast1 (Feb 14, 2018)

I didn't see any CPU usage increases, or memory which was strange. I also saw no additional traffic

I set my server (which in this case is just my personal) to a reasonable amount I thought for php-fpm. I wonder though, if there was a bug in Nextcloud that made it so it kept needing more processes? I do notice when I do SQL writes (which in this case I wasn't) php-fpm CPU usage is completely through the roof


----------

