0

I have a dedicated server with 2 processors, 4 cores and 16GB Ram i'm hosting some php applications that uses high php and mysql usage when i check top command i find that php and mysql consume about 80% of CPU but while checking mpstat command to check usage of every core i find that all of them are 95% idle any explanation for that? note that the server becomes slow when running these applications

top command out put:
7589 root      20   0  287648  31480  18540 R  78.7  0.2   1:49.11 php
1006 mysql     20   0 2400692 214440   6704 S  19.3  1.3 434:34.99 mysqld
18 root      20   0       0      0      0 S   2.0  0.0   1435:51 ksoftirqd/2
3 root      20   0       0      0      0 S   1.3  0.0   1424:58 ksoftirqd/0
5228 www-data  20   0  339616  29608  17772 S   1.3  0.2   0:00.72 apache2

mpstat -P ALL output:
root@datax:~#  mpstat -P ALL
Linux 3.16.0-4-amd64 (datax)    08/15/2016      _x86_64_        (4 CPU)

04:01:58 AM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
04:01:58 AM  all    1.49    0.13    0.83    2.23    0.00    0.03    0.00    0.00    0.00   95.29
04:01:58 AM    0    1.38    0.13    0.62    2.30    0.00    0.03    0.00    0.00    0.00   95.54
04:01:58 AM    1    1.38    0.13    0.62    2.32    0.00    0.03    0.00    0.00    0.00   95.53
04:01:58 AM    2    1.62    0.13    1.04    2.15    0.00    0.03    0.00    0.00    0.00   95.03
04:01:58 AM    3    1.59    0.13    1.04    2.16    0.00    0.03    0.00    0.00    0.00   95.06
  • Anything PHP + MySQL, if it's working to return intensive data searches, queries, etc. or has high traffic will require a lot of CPU to process things. This is not atypical of PHP / MySQL applications. – Thomas Ward Aug 15 '16 at 13:17
  • any explanation of idle is 95% while php and mysql is consuming alot of cpu? also should i add more cores to that server? – Omer Stimpack Aug 15 '16 at 13:18
  • Having run PHP forums in the past, I can say that those have a TON of SQL that tends to nom CPU on high usage. That said, I can't attest to your specific cases because I haven't run or set them up, only state that PHP/MySQL items tend to be very resource-intensive depending on what they're doing. – Thomas Ward Aug 15 '16 at 13:23
  • should i add more cores like 8 or 16 and why i get 95 %idle ? – Omer Stimpack Aug 15 '16 at 16:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.