Re: OT (slightly) swap limits
On Sat, Apr 26, 2008 at 05:13:28PM -0600, Bob Proulx wrote:
> For an enterprise quality server where reliability matters I fully
> agree. Yes. You want twice your ram. But you also want to set
> vm.overcommit_memory=2 for reliability.
> By default Linux will overcommit memory allocation. The malloc(3)
> library can't fail. The fork(2) system call can't fail. But this
> means that if there isn't enough memory in the future that Linux may
> need to kill something. That works similarly to a 'kill -9', the
> process simply stops running. There is no ability of the process to
> log the event to a log file. It just disappears.
>
> Now after learning about this I always disable overcommit. This
> restores a traditional Unix process model. Programs that call for
> memory (through the malloc() interface or fork(), program level
> interfaces that use memory) will see failures if there isn't enough
> memory. This is a Good Thing as it allows applications to handle
> issues and log them generally deal with the problem.
> Summary: So in my mind an Important Aspect of system configuration is
> Reliability and in order to get Reliability it is needed to turn off
> Linux kernel memory overcommit in order to avoid the dreaded and often
> misguided OOM Killer. This is the important point but it affects the
> amount of virtual memory required by a system and that in turn affects
> the need for having swap space configured. With overcommit turned off
> then the rule for twice the amount of RAM is again required. (In
> other words you don't need swap / VM configured equal to twice RAM if
> vm.overcommit_memory=0 as is the Linux default. But then you must
> deal with the OOM killer behavior.)
>
> [ Sidebar: This is how you disable overcommit on a system. This can
> be done temporarily with the following command.
>
> sudo sysctl -w vm.overcommit_memory=2
>
Since debian is supposed to be trying to be reliable (while still being
useable for almost anything), I wonder why this isn't the debian default
(with appropriate documentation as to why, the need for more swap than
other distros, and how to revert back to Linux default if needed)?
Doug.
Reply to: