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.

Is there a way to reserve a specific amount of memory for a specific service/process?

I would like to guarantee that OpenSSH always has enough memory available to it that it can accept a new SSH connection in case the server's memory fills up.

Thanks.

share|improve this question
1  
Oh, don't worry. If memory fills up the OOM killer will "deal" with it for you...at which point you have two problems. –  dmckee Feb 9 '10 at 0:47

1 Answer 1

Generally speaking you don't "reserve" memory on *nix systems - you ensure that there is enough physical RAM + Swap space to handle what your server is doing, and you let the VM subsystem handle it from there (though as dmckee pointed out in Linux you have the "helpful" OOM killer which will kill the "biggest memory user" when you run out of RAM -- the logic of the aforementioned "helpful" subsystem is suspect at best).

You should try to figure out why your system is running out of memory (if that's actually the problem): If you fix the underlying problem you won't need to reserve RAM.

share|improve this answer
    
This problem has happened several times, and it has never been freed up. We had to restart the VPS everytime it happened as we could not SSH in. I am trying to figure out what is causing it right now. I started this post earlier: serverfault.com/questions/110918/linux-log-memory-hogging-issue –  mhost Feb 9 '10 at 3:07
1  
@helphost: Generally the OOM killer does it's job very reliably. If the system is getting exceedingly slow but not stopped, then you have too much swap in place and the thrashing is taking circa 100% of the available CPU. If it is just freezing in may not be memory related at all. –  dmckee Feb 9 '10 at 4:05
    
@dmckee My bias against the OOM killer (& Linux memory management in general) summarized: thoughts.j-davis.com/2009/11/29/linux-oom-killer –  voretaq7 Feb 9 '10 at 4:11
    
That bias taken into account however, @dmckee is on the money - the OOM killer will make sure you have free memory (You just might not like what is kills to get you to that point :-) –  voretaq7 Feb 9 '10 at 4:12
1  
@helphost: Ah... That is another situation entirely...good question. You might want to edit question text to reflect it, though. –  dmckee Feb 10 '10 at 0:01

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.