Categories

See More
Popular Forum

MBA (4887) B.Tech (1769) Engineering (1486) Class 12 (1030) Study Abroad (1004) Computer Science and Engineering (988) Business Management Studies (865) BBA (846) Diploma (746) CAT (651) B.Com (648) B.Sc (643) JEE Mains (618) Mechanical Engineering (574) Exam (525) India (462) Career (452) All Time Q&A (439) Mass Communication (427) BCA (417) Science (384) Computers & IT (Non-Engg) (383) Medicine & Health Sciences (381) Hotel Management (373) Civil Engineering (353) MCA (349) Tuteehub Top Questions (348) Distance (340) Colleges in India (334)
See More

php CPU usage problem

General Tech Bugs & Fixes

Max. 2000 characters
Replies

usr_profile.png

User

( 5 months ago )

 

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

usr_profile.png

User

( 5 months ago )

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

what's your interest


forum_ban8_5d8c5fd7cf6f7.gif