8

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.

2

1 Answer 1

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.

6
  • 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, 2010 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. Feb 9, 2010 at 4:05
  • 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, 2010 at 4:12
  • This is actually a Virtuozzo VPS. So there is 0 swap available. Is it possible that the OOM killer isn't running for us because as far as it can see, the server is not out of memory, only our allocated memory in our VPS?
    – mhost
    Feb 9, 2010 at 23:38
  • 1
    @helphost: Ah... That is another situation entirely...good question. You might want to edit question text to reflect it, though. Feb 10, 2010 at 0:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .