I have vps which causes high load for past 2 weeks.When i issue top command on load time i can see load average reaches 100%.when i stop the apache the load automatically decreases.How can i reslove this issue ?
Try to identify the PID taking maximum % CPU in top -c and cd /proc/PID/ and do an ls -la . You will come to know which website is causing load ...If you are not able to see any thing meaningfull , revert back with your vps control panel name and the number of websites you host on your vps . Also the result of free -m . Some tweaking on your apache conf and also my.cnf would help to an extend ..
600 websites on a vps ..is bit high on a vps .But I see nearly 700 MB free on you free -m result . Can you locate your httpd.conf ( Apache conf ) and Reduce the number of Keep Alive Requests in 100 -150 Range . Also please paste down the status of top -c once . Do you have a control panel for the vps ?
Sorry if someone else already responded to this... I use to read the whole thread before responding, but this..... this..... are you trying to play "funny" here? killing *all* of these running processes will not *fix* the problem, will just leave all of the services down!
Yes, load will be lower, a lot lower, but you will *not* have a server working anymore.
So, you will kill *all* of the processes named: httpd (apache, all of them), exim (all of them), spamd (all of them) mysqld (all of them) even xinetd!.
FYI: httpd : will be *all* of apache, including main process, not just its children, as for xinetd, there use to be *only* one of it, nevertheless, if you kill all xinetd, it will leave all of the services which depends on inetd unavailable.
ksv2nash: Your original post said "killall", and killall does just that: kill all processes given a pattern. Unless.... on the first post, you wanted to use "ps -ef|grep process_name", in which case, you can use kill after that to kill the process (ps -ef will give the PID for all processes on the system).
Also, in order to see which process is taking too much cpu: top , and you can actually kill the process from top, just hit "k".
ksv2nash and ramsh: Now, kill -9 <--- does it works?: most of the time (unless the process goes zombie), but it is *too aggressive* (will not give time to the processes to finish gracefully, and thus can cause some problems, like data corruption under some circumstances) and should only be used with a process that is *really not responding*, for example, you tried to kill it with signal 15 (default), and the process is still there, say, after 1 minute of sending the TERM (15) signal.
As i said u can us killall this command also because with this command your specific process will be ended and ur load will b stable and if u dont want to give that then u can see which process is taking so much load so then take that PID n kill that PIT u can do this select that PID and just press k thn pest that PID.
Ether u can dp ps -fux and see wich PID taking load then select PID and type kill -9 and pest PID............
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0 no-gzip
# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
ExpiresDefault "access plus 300 seconds"
Options FollowSymLinks MultiViews
Allow from all
ExpiresByType text/html "access plus 1 day"
ExpiresByType text/css "access plus 1 day"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 day"
Shiju S Thomas
Why do you insist so much on this?: if you use killall, you will kill ALL processes with the pattern, not just the one with "high-cpu" usage, and the KILL (9) signal explanation, also applies to killall: too aggressive.
Also, as I said: it will not have the problem fixed. Now, I elaborate: you get the load down for a while, but, what if it goes up once again, and then you just kill the processes again, and what if that happen several times.... what... will you just be "killing the process all day". You need to analyze what caused the problem, and then have that cause solved.
You should do one thing , post a ticket to your vps hosting provider.If there is some problem on the main server, due to other vps nodes on the server that too can affect you indirectly, . Also you did not mention till now if you have a control panel or not 9 that will be helpfull in suggesting you solutions ? You need to see what might be the problem causing the load ( as it is a new issue ), . Possibly it will be due to any particular site of yours or DDOS attack or . Try to see if the following command returns any results..
..Also tweak httpd.conf in the way mentioned above Shiju and and restart apache after that . probably
/etc/init.d/httpd restart or
/etc/init.d/apachetl restart ....