To swap or not to swap that is the question
Chris Marget
chris at logsoft.com
Mon Oct 7 11:44:17 EDT 2002
> 100MB. So, my question boils down to a couple of separate issues:
> First, a typical desktop Linux system with 512MB or more of memory.
> Second, a server where you are stuck with a configuration since you don't
> want to take the server down.
> Thirdly, a desktop system running specialized applications, such as CAD,
> which may require large memory configurations.
disclaimer: i'm much more of a solaris guy than a linux guy, and i've
taken most of my advice on these matters from adrian cockcroft and rich
macdougall -- super solaris guys
generally speaking, you need enough virtual memory to support the kernel
and all applications you'll have running simultaneously. you need
enough physical memory to support the kernel and all applications you'll
be *using* simultaneously.
if you've got enough ram to satisfy your whole virtual memory
requirement, there's no reason to have swap space, unless you care to
capture crash dumps for later analysis.
on most systems, disk space costs a whole lot less than memory, so
adding swap space is almost free.
on to the questions:
first, a 'normal' system: my laptop may qualify. it's kind of an old
one, and is a pita to get to the hard disk. i'm frequently running out
of space because a large part of my work involves analysis of gigs and
gigs of network captures. disk space is critical to me, and i really
ought to upgrade this bugger. anyway, here's my memory utilization
right now, middle of the workday, all my apps are running:
[root at localhost tmp]# free
total used free shared buffers cached
Mem: 320940 260760 60180 0 4640 100484
-/+ buffers/cache: 155636 165304
Swap: 0 0 0
note the swap space. if i'm going to load up a monstrous app, i'll add a
swap file, and life is good. if i had 512MB i probably wouldn't need to
add the swap file.
second, server with configuration stuck: if the configuration is stuck,
why is this a question? leave it alone :-) still, you can add and
remove swap on the fly...
third, if you want snappy performance from the cad box, buy it enough
memory so that it doesn't swap, then don't add swap... if you know that
it needs, say, 1GB virtual memory, but have only installed 512MB ram,
that's fine too, but know that it needs 512MB of swap and you'll have
better performance with more memory.
in the case of a general-purpose machine (many desktops) on a budget,
swapping is almost inevitable, so you'd better add some space... but on
a dedicated system that i expect performance from (server of any kind,
cad workstation) i consider swapping to be a problem and try to size
memory to avoid it. ...then what's the point of the swap space if you
don't use it?
/chris
More information about the Discuss
mailing list