0

I'm using a php script that use alot of php and mysql queries installed in dedi with 4 cores and 16gb ram when i use the command top it shows that php consume 80% of CPU however using the command mpstat - ALL to find out usage per core it show different result 96% idle for every core

root@datax:~# top   
PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
27629 root      20   0  287432  31336  18544 R  80.1  0.2   0:19.20 php
1006 mysql     20   0 2400692 100236  11340 S  21.3  0.6 220:35.64 mysqld



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

05:03:13 AM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
05:03:13 AM  all    1.39    0.15    0.51    1.72    0.00    0.03    0.00    0.00    0.00   96.19
05:03:13 AM    0    1.31    0.15    0.47    1.73    0.00    0.03    0.00    0.00    0.00   96.31
05:03:13 AM    1    1.33    0.15    0.48    1.76    0.00    0.03    0.00    0.00    0.00   96.25
05:03:13 AM    2    1.49    0.15    0.55    1.68    0.00    0.03    0.00    0.00    0.00   96.10
05:03:13 AM    3    1.44    0.14    0.55    1.72    0.00    0.03    0.00    0.00    0.00   96.11
1

The mpstat output is showing you the averages since boot (not "now") when you run it without an interval setting. You can adjust your call to:

root@datax:~# mpstat -P ALL 1

this should provide you more of the 'now' information

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.