php-fpm (5.4.13) takes up all cpu resources

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All,

I have a strange problem with php-fpm, I checkd lots of document, but I
can't fix it.
I'm using a Freebsd 91 server to host my website. Nginx and php-fpm 5.4.13
and mysql are using.
The hardware of my server is
12Core CPUs,
32G memory
6 HDD used as a Raidz2 array to host website
2 SSD used as a mirror array to host Database

After I upgrade from 5.4.11 o 5.4.13, I got below problem.

Usually, my system is in below status:(top)

last pid: 52977;  load averages:  4.70,  4.66,
5.55
301 processes: 2 running, 299 sleeping
CPU:  6.5% user,  0.0% nice,  6.3% system,  0.9% interrupt, 86.3% idle
Mem: 7029M Active, 11G Inact, 12G Wired, 1076M Cache, 399M Free
ARC: 8412M Total, 3190M MFU, 1763M MRU, 624K Anon, 209M Header, 3249M Other
Swap: 36G Total, 145M Used, 36G Free
  PID USERNAME    THR PRI NICE   SIZE    RES STATE   C   TIME   WCPU COMMAND
52728 www           1  25    0   150M 35564K accept 13   0:01  5.86% php-fpm
52735 www           1  25    0   150M 35416K accept 16   0:01  5.76% php-fpm
52740 www           1  25    0   150M 37668K accept 14   0:01  5.66% php-fpm
52739 www           1  24    0   150M 36424K accept 12   0:01  5.66% php-fpm
52708 www           1  24    0   150M 36324K accept 10   0:01  5.66% php-fpm
52724 www           1  24    0   150M 37740K select 16   0:01  5.57% php-fpm
52714 www           1  25    0   150M 36952K accept 21   0:01  5.57% php-fpm
52719 www           1  25    0   150M 37252K accept 23   0:01  5.57% php-fpm
52717 www           1  25    0   150M 39004K accept 12   0:01  5.57% php-fpm
52734 www           1  25    0   150M 37720K accept 18   0:01  5.57% php-fpm
52726 www           1  24    0   150M 37308K accept 23   0:01  5.47% php-fpm
52737 www           1  25    0   150M 37832K accept 14   0:01  5.37% php-fpm
52721 www           1  25    0   150M 36548K accept 22   0:01  5.37% php-fpm
52710 www           1  25    0   154M 38792K accept 16   0:01  5.37% php-fpm
52723 www           1  25    0   150M 35768K accept 10   0:01  5.37% php-fpm

But sometimes, I found a php-fpm will take up about 25%+ cpu resource, then
the cpu usage of php-fpm will get increased one by one. Then php-fpm will
take up all CPU resources.
Like below:

last pid: 54212;  load averages:  75.83,  75.55,
75.73
up 3+10:47:39  10:27:53
301 processes: 6 running, 295 sleeping
CPU:  6.8% user,  0.0% nice,  95.2% system,  0.7% interrupt, 0.0% idle
Mem: 7021M Active, 11G Inact, 12G Wired, 1358M Cache, 561M Free
ARC: 8525M Total, 3438M MFU, 1619M MRU, 1866K Anon, 213M Header, 3253M Other
Swap: 36G Total, 145M Used, 36G Free
  PID USERNAME    THR PRI NICE   SIZE    RES STATE   C   TIME   WCPU COMMAND
53939 www           1  31    0   150M 33096K accept 22   0:01  28.59%
php-fpm
53941 www           1  31    0   154M 38144K accept 20   0:01  28.40%
php-fpm
53938 www           1  30    0   150M 32816K accept  3   0:01  27.57%
php-fpm
53677 www           1  52    0   150M 28440K accept  2   0:04  26.49%
php-fpm
53948 www           1  27    0   150M 28964K accept 19   0:01  24.69%
php-fpm
53947 www           1  26    0   150M 29272K accept  8   0:01  24.05%
php-fpm
53951 www           1  25    0   150M 31208K accept 17   0:01  23.86%
php-fpm
53953 www           1  24    0   150M 35300K accept 15   0:00  23.86%
php-fpm
53950 www           1  25    0   150M 28268K accept  2   0:00  23.76%
php-fpm
53954 www           1  24    0   150M 35476K accept 19   0:00  23.76%
php-fpm
53955 www           1  24    0   150M 31292K accept 21   0:00  23.76%
php-fpm
53956 www           1  24    0   150M 34064K accept 19   0:00  23.66%
php-fpm
53962 www           1  24    0   150M 33224K CPU9    9   0:00  23.66%
php-fpm
53960 www           1  24    0   150M 33548K CPU17  17   0:00  23.66%
php-fpm


Below is the php-fpm.slow.

[01-Apr-2013 16:46:52] WARNING: [pool www] child 96623, script
'/web/www/forum.php' (request: "GET /forum.php") executing too slow
(30.661218 sec), logging
[01-Apr-2013 16:46:52] WARNING: [pool www] child 96620, script
'/web/www/forum.php' (request: "GET /forum.php") executing too slow
(31.778921 sec), logging
[01-Apr-2013 16:46:52] NOTICE: child 96764 stopped for tracing
[01-Apr-2013 16:46:52] NOTICE: about to trace 96764
[01-Apr-2013 16:46:52] NOTICE: finished trace of 96764
[01-Apr-2013 16:46:52] NOTICE: child 96763 stopped for tracing
[01-Apr-2013 16:46:52] NOTICE: about to trace 96763
[01-Apr-2013 16:46:52] ERROR: failed to ptrace(PT_IO) pid 96763: Bad
address (14)
[01-Apr-2013 16:46:52] NOTICE: finished trace of 96763
[01-Apr-2013 16:46:52] NOTICE: child 96762 stopped for tracing
[01-Apr-2013 16:46:52] NOTICE: about to trace 96762
[01-Apr-2013 16:46:52] NOTICE: finished trace of 96762
[01-Apr-2013 16:46:52] NOTICE: child 96761 stopped for tracing
[01-Apr-2013 16:46:52] NOTICE: about to trace 96761

The only way to fix this issue is to restart php-fpm.


At first, I though it's a mysql error, but I monitorred mysql process, and
I found that there is no slowlog. I tried to reinstall php, but this issue
still exist.

Can anyone help on this issue?

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux