Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Jan 2000 22:11:22 +0000 (GMT)
From:      Terry Lambert <tlambert@primenet.com>
To:        bright@wintelcom.net (Alfred Perlstein)
Cc:        dchulhan@uwi.tt (Dale Chulhan - Away), antionline@onelist.com, chat@FreeBSD.ORG
Subject:   Re: Swap Files vs Swap Partitions
Message-ID:  <200001182211.PAA12048@usr09.primenet.com>
In-Reply-To: <20000116183846.M508@fw.wintelcom.net> from "Alfred Perlstein" at Jan 16, 2000 06:38:46 PM

next in thread | previous in thread | raw e-mail | index | archive | help
> > looking for PROPER ( qualified ) answers to this question from a
> > friend...
> > 
> > > In the context of *nix...what are the distinct pros 'n cons
> > > re: swap partitions vs. swapfiles???? apart from the obvious:
> > > the filesystem overheads,  I mean.
> 
> exactly that.  swap partitions are _much_ better than swapfiles,
> note that some operating systems allow swapping to the free-space
> on a filesystem, however once you get that far you are probably so
> seriously hosed it's not worth the effort.

Swap files go through the file system to the device driver to
the disk.

Swap partitions go through the device driver to the disk.

Swap files are limited to the maximum file size.

Swap partitions are limited to the maximum device size.

If you run out of swap space on a partition, you can not recover.

If you run out of swap space on a file, you can recover by
permitting the growth of the file; however, if you place an
administrative limit on the growth, then you in the same boat
as if you wre using a partition.

If your swap utilization is lowered on a swap partition, you
can't recover the space for other uses.

If your swap utilization is lowered on a swap file, you can
recover the resources for use by other parts of the system.


This is similar to other administrative resource limits, which
can limit legitimate use of scare resources, in an ill-conceived
attempt to "save the user" from themselves or a malicious user
that you can't just kick off the machine; this works for ISPs
and similar users, but for desktops and dedicated servers, it's
kind of pointless to stage denial of service attacks against
yourself.

Administrative limits are also kind of useless when you have
differential use of the machine (e.g. not the same kind of
uniform load 24 hours a day, so it doesn't make sense to hog-tie
your payroll runs at 3 AM to "protect" your database reports
at 6 PM).


In other words, swap files may seem to be a bad idea, but if
you are going to disk anyway, dereferencing direct and indirect
blocks are the least of your worries about latency issues, and
the added flexibilty they offer when implemented correctly will
generally more than make up for the problems you might encounter.


As a final example, the NeXTStep OS used swap files, and so long
as you dd'ed /dev/zero into the files before enabling swapping
(to avoid overcommitting your available disk blocks for swapping),
it was a wonderful feature that save our butts in Mathematica and
FrameMaker on numerous occasions.


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-chat" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200001182211.PAA12048>