# PHP-FPM (php 5.5/5.6) eating up all cpu (system 99%)



## plq (Apr 12, 2015)

Hi,

We have +10 FreeBSD servers with our dedicated e-commerce system written in CakePHP and MySQL. System is well optimized (we use APC/APCu, full page cache on disk - strongly modified cache soultion from CakePHP framework, etc.).

All servers are configured in similar way (FreeBSD 10/10.1) with Apache 2.2/2.4, PHP-FPM 5.5/ 5.6, MySQL 5.6 etc. We did not have any problems until last week.

We configured new server and moved one of ours customers from 2 servers WEB + DB - (6cores, 64GB RAM, 2x300GB INTEL SSD/2x2TB SATA3) to one server - 20 cores, 256GB RAM, MEGA RAID LSI (2x2TB Sata 3 and 2x300GB Intel SSD). 

Theoretically new server should work faster - and it is, but sometimes php-fpm will take up all CPU resources. We have to restart PHP-FPM and then everything is ok (sometimes for 30 minutes, sometimes for 12 hours).

We have install PHP 5.6.6, upgrade to 5.6.7 and downgrade today to 5.5.27 (now it is even worse). 

We are almost sure that there is enough resources (php scripts execute < 0,1-0,3s most the time) but something cause PHP to hang (traffic is similar).

Here are some information about our system:

```
FreeBSD xxxx.xxxx.com 10.1-RELEASE-p6 FreeBSD 10.1-RELEASE-p6 #0: Tue Feb 24 19:00:21 UTC 2015     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
```


Disk usage:







TOP:


















We have changed php-fpm configuration in different way:
- dynamic, with max_children = 300, max_requests = 1000
- static, with max_children = 50, max_requests = 1000/10000/100000
etc.

On older servers we have served simillar traffic without problems (load times were worse).


----------



## plq (Apr 12, 2015)

Gstat:









Systat -vmstat:


----------



## plq (Apr 12, 2015)

getopt said:


> Unfortunately I cannot see any of your linked images. But regarding your PHP56 and caching see my post:
> https://forums.freebsd.org/threads/problems-with-update-phpmyadmin-4-4-0.51164/#post-286760



Thank You, but we are using Pecl-APCu


----------

