Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I've been shutting down and restarting the server, but is there something short of that you can do to quickly recover from a high-paging situation?

share|improve this question
    
One of my friend used to run a script which will reboot the machine in such a case by itself. So someone can respond with such a thing, just to let you know there is still hope :) –  Ashfame Mar 16 '11 at 3:36
add comment

2 Answers 2

up vote 4 down vote accepted

Prevention is better than cure, so you should try to avoid such situations in the first place. If the problem is caused by uncontrolled growth of memory usage (eg. memory leaks) you could setup Monit to restart the monitored process once it exceeds a certain memory limit. If the traffic is spiky, you might consider throttling the number of requests. It's always better to handle less requests with reasonable performance instead of trying to serve everybody but extremely slowly.

share|improve this answer
    
exactly - see what is consuming your RAM, like - too many processes running, and work with that, instead of rebooting the server. –  Osis Mar 16 '11 at 9:55
add comment

Unfortunately there is no quick way if the system is paging a lot. If you are still able to access the system you can try to kill the most memory consuming processes.

ps -e -o rss=,pid=,comm= | sort -n

will give you an idea on memory consumption. First column shows the resident set size, second the pid of the process and third the command executed.

Be patient and try to end the process by

kill -15 <pid>

If this does not work any more, try a

kill -9 <pid>
share|improve this answer
    
kill -9 reminds me of this youtube.com/watch?v=Fow7iUaKrq4 –  Adam Byrtek Mar 17 '11 at 22:06
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.