Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

After installing and configuring WHM/cPanel on Centos 5.7, it seems that often when I try to access WHM, cPanel, or one of the 3 websites sitting on the server, everything freezes (WHM, cPanel and all the websites), and I notice the system CPU shooting up to over 80% (while the user CPU stays fairly low). This doesn't always happen—sometimes everything works fine (and it's not a PHP problem).

Two questions:

1) The server has 2 processors, from what I understand this means that the CPU usage can go up to 200%. How do I make sure that the system is utilizing both processors?

2) How do I view the system processes? It doesn't seem like there's any mention of them anywhere, yet they are utilizing all the CPU for no apparent reason.

====

Things reqested in comment:

top (during problem): http://ynhockey.net/personal/cpanel_linux_top2.png

uptime:

13:38:13 up 11 days, 20:03,  1 user,  load average: 0.15, 0.07, 0.05

free:

             total       used       free     shared    buffers     cached
Mem:       2058752    1718608     340144          0     280996     852044
-/+ buffers/cache:     585568    1473184
Swap:       522104     183784     338320
share|improve this question
    
SSH on to the box and look at top, free and uptime (individual processes, free memory/swap and system load). Post the output from there and we can help you some more –  sam Nov 28 '11 at 11:18
    
Thanks. I have edited the original post to include the things you requested. –  Ynhockey Nov 28 '11 at 11:49
add comment

1 Answer 1

up vote 0 down vote accepted

1: Fully Using available Cores

IIRC the CPU(s) counts at the top of top's output are normaised for the number of cores, so that 100% is all your available CPU resource being used. The %CPU column isn't normalised though, so can be over 100%.

Top verify this (it may vary depending on the verison of top on your system open one session per core and run gzip -c < /dev/zero > /dev/null in them, while watching top in another session. The CPU(s) figures should total ~100% rather than 100*cores (they do on top on the systems I've just tried that on to confirm).

One complication that may affect the above test is hyperthreading if you have that available in your CPU and it is enabled. top will see all the virtual cores as real ones (so with one two-core CPU with hyperthreading you'll see four cores in top when you turn on the per-core display by pressing 1), yet hyperthreading does not give the potential 100% boost in processing resource this would imply (see http://en.wikipedia.org/wiki/Hyper-threading). Using the same test on my netbook (2 cores with HT turned on, so 4 virtual cores) shows simialar results: to single-threaded CPU eating tasks make top show processor use to be ~50% and four such processes make it show ~100% (though the total amount being processed is not twice as much due to the way HT shares CPU resources between the vcores in each core).

2: Process Listing

The %sys does not count seperate system processes. Any process can spend some time in "userland" (doing calculations, processing strings, and so forth) which is counted in %user and some time in "kernel space" (when it asks the kernel to allocate some memory or so forth) which is counted in %sys.

You should see all the processes that are currently present in top's output, but processes "escape" being counted in tops list if they are created and end within top's polling interval (but the overall time used is still seen by top as it uses kernel-wide counts for these figures).

With modern equipment you could have many processes being created, doing some work, and ending, in the time that top spends idle (usally one second by default) between rescanning the current process list and displaying it.

You might find evidence to confirm if this is happening in your log files, though unfortunately it could also be processes that leave no log footpint.

share|improve this answer
    
Thank you for the thoughtful answer. Do you have any suggestions on how to monitor the CPU usage and see what really takes up so much CPU? When the situation becomes similar to the image I provided above, all web services on the server completely freeze up, and SSH works very slowly too. This would be impossible to maintain on a production shared server. Any suggestions are welcome. –  Ynhockey Nov 28 '11 at 14:24
    
You may be able to use the processess accounting tools (if the relevant hooks are enabled in your kernel which I think they are in all modern distributions) to find more clues about the source of the bursts of activity. I've not used those tools myself though, so can't give any guidence above what the following links contain. See cyberciti.biz/tips/… for some details, the GNU documentation is at gnu.org/software/acct/manual/accounting.html –  David Spillett Nov 28 '11 at 17:23
add comment

Your Answer

 
discard

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

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