View Full Version : server load question
dragonhawk 11-22-2002, 09:06 PM So far I have 2 sites on my dedicated server (both are fairly high traffic). And the server load average is around 1.50 constantly...
Just wondering if this is normal for high traffic sites.
I am checking 'top' and have this line:
%CPU: 96.2
%MEM: 1.5
TIME: 3658m
COMMAND: httpd
Does httpd actually run for that long and take up 96.2% CPU?
JeremyV 11-22-2002, 09:23 PM well, while that isn't an unacceptable load average, it would be easier to determine some things by giving your hardware stats. For example, it a single or dual processor, how much ram, etc.
Also take into account how much idle CPU is available... if that is really 96.2% CPU usage giving you only 3.8% idle, you may have some problems.
dragonhawk 11-22-2002, 09:34 PM AMD Duron
1GHz
512 MB RAM
40 GB Hard Drive
I've got 2 other dedicated servers and I've never seen any process run for over 3600 minutes... would you recommend i restart httpd?
JeremyV 11-22-2002, 09:36 PM Yeah, it isn't too often you would see a standard process like that run for that long. A quick restart of the httpd may fix it if it is a runaway process.
DarktidesNET 11-22-2002, 09:47 PM I'd go with rebooting it too. I've had problems in the past where after a few days of massive traffic Apache would be using 1-3 loads. Rebooting the httpd made it drop to 0.00-0.20 again.
dragonhawk 11-22-2002, 09:49 PM ok then... i'll restart httpd... guess it's not quite normal then :D
Thanks
Acronym BOY 11-22-2002, 10:00 PM I'd look through your logs and see what happened during the past 3658 minutes (thats a lot of logs though) that may have caused it, chances are you are more likely to find it as an older entry than a newer one, if anything at all. Though you may find nothing.
Chalk it up as a glitch and hope it doesnt happen again. If it does, you will need to work on reproducing it somehow.
dragonhawk 11-22-2002, 10:02 PM Heh, it didn't do anything... I ran: /etc/rc.d/init.d/httpd restart and it's still up there...
dragonhawk 11-22-2002, 10:03 PM k, I ran a stop and start and that solved the problem :p
DarktidesNET 11-22-2002, 10:06 PM httpd restart should do it also :P
acameron 11-24-2002, 01:41 AM Definately check you log files. CPU will always spike when a process starts just like when you fire upa program on your desktop. Its when it is consistantely up there you want to check it out.
aNc
lotuslnd 11-24-2002, 03:38 AM What I've found in the past is that a PHP script has usually hung, causing Apache (httpd) to consume excessive amounts of CPU / memory. With Solaris, you can find the working directory of that httpd PID using pwdx, which helps narrow down where the process is operating or do a truss on the PID to see what exactly the PID is doing. A simply apachectl restart (or graceful, which is a bit nicer) will kill off those nasty PID's. Try to find out where they're coming from though, as chances are they'll be back!
clockwork 11-24-2002, 03:45 AM Try running the "sar" command (If you use Redhat, it should be installed by default).
That'll give you a good idea of what your usage is like... it also will store (default on redhat) usage for each day in /var/log/sa/ (run sar dayfilename to generate the stats)
DarktidesNET 11-24-2002, 05:25 AM Just ran into this again:
nobody 28409 96.9 1.5 11712 7688 ? R Nov23 629:30 /usr/local/apache/bin/httpd -DSSL
96.9% cpu
Before ...
root@zeus [~]# uptime
4:15am up 3 days, 12:58, 1 user, load average: 2.18, 2.19, 1.75
root@zeus [~]# httpd restart
/usr/sbin/httpd restart: httpd restarted
Now ...
root@zeus [~]# uptime
4:22am up 3 days, 13:05, 1 user, load average: 0.00, 0.58, 1.13
Not sure why it's doing that but that's the only reason I get a load issue (from the Apache thing). I just find it hard to believe it's a PHP script causing this.
NexDog 11-24-2002, 05:35 AM What you should do is find the process (PID) number in top and zap the hung process. Usually:
kill *** (stars being the process number)
If it's still there then you need to send the kill command in first via:
kill -9 *** (being the PID)
Then restart Apache if you want though there shouldn't be a need.
DarktidesNET 11-24-2002, 05:42 AM I kill'd -9'd it before about 7 days agoi, went to watch TV for a bit then noticed that apache had totally died. I figured I probably shouldn't of killed it and just figured restarting it was a safer bet.
I'll remember that for next time thanks. ;)
NexDog 11-24-2002, 06:13 AM Restarting Apache won't always clear hung processes as they cling to port 80. Just as restarting MySQL won't kill off MySQL processes some times. A direct kill will do in the bad process but if it hasn't let apache do anything else, you leave it dead in the water, hence the need for a restart.
clockwork 11-24-2002, 06:16 AM ...have you checked the error log?
Apache is generally pretty good at reporting errors.
DarktidesNET 11-24-2002, 06:20 AM NexDog, oh okay.
clockwore, no. I don't know how ... new to using Linux just got my own servers about 1 or 2 weeks ago and don't know too much yet. Still learning a great deal about it.
clockwork 11-24-2002, 06:26 AM Try to just run:
tail -f /usr/local/apache/logs/error_log
And watch over it, or, alternatively, open it up in an editor (or a simple 'more') and look at the timestamps for when your problem was occuring.
NexDog 11-24-2002, 06:27 AM I'm just used to Plesk's structure but the error_log in Linux is pretty much in the same place:
/var/log/httpd
and do:
less error_log
to scroll to the bottom, hit shift and g.
Of course your domain will have it's own error_log too, visible in shell and via FTP too probably.
clockwork 11-24-2002, 06:42 AM Originally posted by NexDog
I'm just used to Plesk's structure but the error_log in Linux is pretty much in the same place:
/var/log/httpd
and do:
less error_log
to scroll to the bottom, hit shift and g.
Of course your domain will have it's own error_log too, visible in shell and via FTP too probably.
Well, he's got it installed in /usr/local (see his previous posts), could very likely be a CPanel box.
|