[CentOS] Re: Apparently no swap configured

Thu Oct 30 10:10:18 UTC 2008
William L. Maltby <CentOS4Bill at triad.rr.com>

On Wed, 2008-10-29 at 19:07 -0700, John R Pierce wrote:
> Stephen Harris wrote:
> > In older BSD systems (eg around SunOS 4 times or before) swap space was
> > utilised oddly; all memory was allocated from swap, so you needed _at
> > least_ <physmem> of swap just to use all your real memory!  So if you
> > added <physmem> of swap then your total virtual memory size was still
> > only <physmem>.  No help!  So the rule of thumb came along that said
> > "swap = 2*<physmem>" and that gave you a VM of 2*<physmem>.  
> 
> 
> <old codger hat>  this was also how early IBM System/370 DOS/VS 
> worked...  the swap space (which was contiguous cylinders of the disk, 
> btw) was mapped 1:1 to virtual memory address space </old codger hat>
> <snip>

<another old codger hat>
I believe the differing "recommendations" is a result of the transitions
over the life of *IX systems. When I first began running real UNIX (TM)
on Dec and PC equipment (1978-1985), memory was slow, expensive and
limited. Ditto for HD space. In order to run even fairly basic systems
with any utility involving multi-tasking or multi-users, swap was need
to page memory. Tunables were provided for high/low water marks and
preferences for high/low priority processes. IIRC, initially there was
no oom kill capability.

Recommended swap at that time was at least two times real memory and 4
times for "heavily loaded" systems. If you were doing more, bump that
number appreciably. But it had severe costs when you maximum HD size
might be 40MB, so you didn't want to over-allocate.

Over time, memory/HD attributes and "flavors" of *IX changed.
Applications changed. Shared memory, libraries came into vogue.
Relocation became possible. ELF appeared.

All this stuff changed the real needs for swap. But old habits die hard.
So we still have conflicting recommendations floating around. Several on
this list have been successfully configuring 0 swap for their usage. For
other usage that may not be appropriate.
</another old codger hat>

Summary: as it always has been, your application and load profile
determine the need. Since HD is so "cheap" now, I have a couple gig of
swap, but haven't seen it used since sometime in CentOS 5.0. Even when I
login in as multiple users and fire up several X/Gnome desktops for
each, no swap usage. There's probably been some swap used, but it wasn't
seen by me.

-- 
Bill