LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   CPU usage not balanced over all cores (https://www.linuxquestions.org/questions/linux-server-73/cpu-usage-not-balanced-over-all-cores-4175427669/)

sparkey 09-17-2012 12:37 PM

CPU usage not balanced over all cores
 
Hi,

Please tell me if the below is normal? I am running apache2 on a webserver but i cant get ubuntu to sort the load on the different cpu cores. As stated below it preferes to but everything on cpu0 but i would rather have it balanced over all the cores.

I am running Ubuntu 12.04 on ESXi 5.0.

Code:

Linux 3.2.0-23-generic (Server)  2012-09-17      _x86_64_        (12 CPU)

19:34:00    CPU    %usr  %nice    %sys %iowait    %irq  %soft  %steal  %guest  %idle
19:34:00    all    0,62    0,00    0,21    0,00    0,00    0,08    0,00    0,00  99,09
19:34:00      0    6,05    0,00    0,87    0,00    0,00    0,99    0,00    0,00  92,08
19:34:00      1    0,37    0,00    0,23    0,00    0,00    0,00    0,00    0,00  99,39
19:34:00      2    0,14    0,00    0,07    0,00    0,00    0,00    0,00    0,00  99,79
19:34:00      3    0,05    0,00    0,01    0,00    0,00    0,00    0,00    0,00  99,94
19:34:00      4    0,03    0,00    0,01    0,00    0,00    0,00    0,00    0,00  99,96
19:34:00      5    0,02    0,00    0,01    0,00    0,00    0,00    0,00    0,00  99,97
19:34:00      6    0,02    0,00    0,02    0,00    0,00    0,00    0,00    0,00  99,96
19:34:00      7    0,57    0,04    1,02    0,01    0,00    0,00    0,00    0,00  98,35
19:34:00      8    0,03    0,00    0,06    0,00    0,00    0,00    0,00    0,00  99,91
19:34:00      9    0,06    0,00    0,11    0,00    0,00    0,00    0,00    0,00  99,82
19:34:00      10    0,01    0,00    0,01    0,00    0,00    0,00    0,00    0,00  99,98
19:34:00      11    0,05    0,00    0,09    0,00    0,00    0,00    0,00    0,00  99,86

Here is also a printscreen of the htop command.
http://tinypic.com/r/35jh1g7/6

Best regards

kilgoretrout 09-17-2012 02:07 PM

In my experience, that is completely normal.

johnsfine 09-17-2012 02:59 PM

Quote:

Originally Posted by sparkey (Post 4782478)
i would rather have it balanced over all the cores.

Why?

When the CPU load is so light that one core is more than you need, why do you care how that load is distributed?

sparkey 09-17-2012 03:44 PM

Sometimes it spikes 100% on one core and almost anything on the others. When that happens i experience lag on the website.

johnsfine 09-17-2012 03:55 PM

Quote:

Originally Posted by sparkey (Post 4782631)
When that happens i experience lag on the website.

Correlation does not imply causation.

You have lots of apache2 processes (probably too many). It is very unlikely that anything is restricting the apache2 processes to one core or restricting the work to one apache2 process.

So when the system is lagging, it is very likely that either the internet access bandwidth or the disk drive is the limiting factor and the CPU is not a limiting factor.

Under those conditions, one core might be near 100% usage. But that does not imply that having one core near 100% usage caused the lag.

sparkey 09-17-2012 04:32 PM

Quote:

Originally Posted by johnsfine (Post 4782640)
Correlation does not imply causation.

You have lots of apache2 processes (probably too many). It is very unlikely that anything is restricting the apache2 processes to one core or restricting the work to one apache2 process.

So when the system is lagging, it is very likely that either the internet access bandwidth or the disk drive is the limiting factor and the CPU is not a limiting factor.

Under those conditions, one core might be near 100% usage. But that does not imply that having one core near 100% usage caused the lag.

No i do not have too many processes running. We also have the latest HP ProLiant DL360 Gen8 with lots of resources to go with. The server is also hooked up to dual 1Gbit/s WAN and SAS2 15k RPM in RAID10 running so the chance of my hardware being to crappy is below zero.

I see what you mean but it can't be a coincidence that when it spikes i can see one core being 100% due to the other being close to 0%.

jefro 09-17-2012 08:09 PM

Not all programs are fully smp let alone ones that can support more than 4 cores.
This may include drivers too so that any part of any operation could be limited to a single core.


Just curious, you only have one guest OS on esxi?

sparkey 09-18-2012 05:04 AM

Quote:

Originally Posted by jefro (Post 4782806)
Not all programs are fully smp let alone ones that can support more than 4 cores.
This may include drivers too so that any part of any operation could be limited to a single core.


Just curious, you only have one guest OS on esxi?

Okay i see thanks. I see activity though on the other cores but not from apache it seems.

I am running only one more VM atm with near to 0 load atm due to that it has not yet been put in production.

273 09-18-2012 05:20 AM

I'm sorry if this has already been looked at (I'm far from knowledgeable abut these things) but could this be caused by Apache MPM settings?
http://httpd.apache.org/docs/2.2/mpm.html


All times are GMT -5. The time now is 12:24 PM.