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

I have a media temple server with a Plesk interface.

The site runs a Wordpress installation with some custom code.

My issue is that the server keeps falling over due to extremely high CPU and Memory Usage.

I am totally new to Plesk and have no idea where to look or start.

I need to find out what's causing the issue ideally if I could write some PHP code to pop on my server.

I found this code:

<?php

exec('TERM=xterm /usr/bin/top n 1 b i', $top, $error );
echo nl2br(implode("\n",$top));
if ($error){
    exec('TERM=xterm /usr/bin/top n 1 b 2>&1', $error );
    echo "Error: ";
    exit($error[0]);
}

?>

which outputs:

top - 04:49:37 up 26 min, 0 users, load average: 7.06, 4.10, 2.02
Tasks: 40 total, 2 running, 37 sleeping, 0 stopped, 1 zombie
Cpu(s): 10.8%us, 0.2%sy, 0.0%ni, 88.9%id, 0.1%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 946344k total, 693744k used, 252600k free, 0k buffers
Swap: 0k total, 0k used, 0k free, 0k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
10201 apache 16 0 374m 48m 3940 R 99.6 5.2 0:04.84 httpd
11695 apache 15 0 12608 1092 840 R 0.0 0.1 0:00.00 top

but I have no idea what this all means.

Does anyone have any tips to finding out what the issue?

share|improve this question

migrated from stackoverflow.com Nov 11 '11 at 12:09

This question came from our site for professional and enthusiast programmers.

1  
Is this question more appropriate for ServerFault? –  liquorvicar Nov 11 '11 at 10:03
    
Look at loops in your code. The most common cause of race condition is an infinite/very long running loop that never waits for anything before the next iteration. Try and make the loop continuation condition into something that will block while there is nothing to do. –  DaveRandom Nov 11 '11 at 10:11
    
Can you at least spell the words in your title properly? Or is "rinning" a word I don't know about? "Server CPU and Memory rinning @ over 100% - Plesk" –  Buttle Butkus Nov 11 '11 at 10:25

1 Answer 1

up vote 1 down vote accepted

Something is a little fishy here: Your load average is above 7 (which means you've got seven runnable processes on the run queue that are waiting for the CPU to become available to run) -- but your processors are 88.9% idle. And you've got ~200 megabytes of memory free. I'd say that this system is very lightly loaded -- except for the first line.

Another possibility is that top(1) is lying to you -- just how virtualized is this setup? Perhaps something like OpenVZ or Virtuozzo or grsecurity could cause the numbers to tell only a very small portion of the story.

share|improve this answer
    
ill look into the loop thing and also pass the above comments onto the developer see if he can sort thus out, thanks again –  odd Nov 12 '11 at 14:53

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.