Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Helo, my server is a 2x quad core, with 8gb ram, it runs LAMP for a middle size website (120 pages opened daily) i installed munin to monitor the CPU, and this is the graph: why it's using only 2 of 8 cores? maybe the munin doesn't calculate well the cpu load?

there is a way to force the multitasking ip php mysql apache? i already use MPM with apache.

thanks simon

share|improve this question
Where does it say in that graph that its using only 2 cores? To me it looks like a summary of all cores.. – pauska Jul 30 '10 at 11:26
SORRY 120,000 pages – Simone Jul 30 '10 at 14:54
i meant 120,000 pages.. sorry for alerting you :D – Simone Jul 30 '10 at 14:57
up vote 4 down vote accepted

First of all, rest assured that there doesn't seem to be any hardware or O.S. problem: your graphic shows the system is properly acknowledging the presence of 8 available CPUs; thus, there's nothing to be tweaked in the BIOS or in the Linux kernel.

As for the possible reasons your applications aren't making full use of all your CPU power, they are basically three:

  1. Your current workload just doesn't need so much power.
  2. Your applications don't allow much (if any) parallelization.
  3. Your servers (MySQL and Apache) are configured to only make use of single CPUs.

The third option is the most implausible, because by default MySQL and Apache are totally happy to go multithread, if they can; so let's focus on the other two ones.

How's the server's response time under the current load? Does it feel "slow", or does it answer promptly? To rule this out, can you run benchmark tests to put more load on your server? If CPU usage goes up under a heavier load, then your server is doing fine, it just doesn't currently need so much CPU power. But if it doesn't and the server starts answering poorly (or if it already is doing that), then you should have a look at option 2.

Regarding that: Apache is inherently parallel, as it "just" processes and serves web pages; so the culprit could be MySQL. What sort of queries are your running against it? Are you just doing SELECTs, or are you (perhaps heavily) INSERTing, UPDATing or DELETing data? Also, what kind of transactions and locks are you using? Depending on all of this, it may very well be that queries are just being executed serially, because the server can't properly parallelize them. Also, the same thing could happen because MySQL is waiting for disk I/O or because it doesn't have enough memory available. You should run some profiling tool against your MySQL and see what it has to say about this.

share|improve this answer

Apache + PHP + MySQL should utilize all the resources automatically without further tweaking. What if you just take a look at the top command and check out the cpu usage?

And, are you sure the cpu usage should be higher than that? An 8-core machine is such a powerhouse that 800% cpu utilization would require some heavy traffic or heavy computing.

share|improve this answer

120 pages opened daily is peanuts to that powerhouse. Your not coming close to maxing out one core let alone 8.

You seem to be looking for a problem, is there a number of slow pages that you are trying to figure out are slow?

A page view will usually only run on one core as a single process/task/thread. Your database will be working in another, however if the processing it has to do is complex it can take time, no matter how many cores you have.

90% of the time slow pages are due to missing indexes in the database.

share|improve this answer
SORRY 120,000 pages – Simone Jul 30 '10 at 14:54

I do think this has to do with how tools like munin shows resources and not so much about CPU utilization. Try installing "htop" as it will show you one bar for each core in a good manner, this will probably help you get the answer.

I have had the same thing with cacti and came to the conclusion that the monitoring adds up 100% per core. Thats why you have 800% available, maybe you have a better optimized setup than you even dared to hope! ;)

share|improve this answer
VERY VERY GOOD!!, everything is working, thanks – Simone Aug 3 '10 at 10:11

MySQL query cache use can limit the operation to a single thread. Check if you use it and disable it if you don't need it. Query cache will drop your server load on read operations but it will be a burden if you do a lot of writes and/or your server has to scale to a massive load. 120 hits per day is nothing.

share|improve this answer

It seems to use 8 cores, because you got 800% max on the left side in your diagram.

share|improve this answer
If you look closer you'll see that most of that is "idle" time, meaning the processor is not being utilised. – PP. Jul 30 '10 at 15:15

That's a graph of your percentage CPU used. It's nothing to do with cores.

share|improve this answer

As others have said that graph does not support your assertion that the webserver is only using one core.

middle size website (120 pages opened daily)

Really? 120 hits per day? And you've got a big beefy server to support that? I wish I had your IT budget. That hardware should be able to support more than 10,000,000 hits / day! If it needs 1/8 th of its total CPU capacity for 1 hit per minute then there's something very wrong here.

(BTW it is possible to set/read CPU affinity on Linux - see 'man taskset' for details).


share|improve this answer
SORRY 120,000 pages :D – Simone Jul 30 '10 at 14:55
Still seems a lot of cpu for this much activity. – symcbean Jul 31 '10 at 21:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.