SUMMARY: Benefits of swap PARTITIONS vs. swap FILES?

From: Ned Forrester (ned@kilowatt.whoi.edu)
Date: Tue Jun 21 1994 - 15:03:43 CDT


-----------------------

My original question:

I have a Sparcstation IPX running SunOS 4.1.2 (someday 4.1.3),
with 16MB RAM and a 400MB disk having a 32MB swap (b) partition.
I use this primarily single user and while my applications don't
run out of memory, they do a lot of paging. I will be upgrading
to 32MB RAM and adding a local 1GB disk. I have read the
appropriate FAQs and searched the sun-managers gopher site to
learn that I should distribute swap space on the second disk (at
least an equal 32MB) for maximum performance.

My question is: What are the advantages of the following two
methods of creating swap space?
1. Create a separate swap (b) PARTITION on the new disk.
2. Use mkfile to create a swap FILE in a larger general use
   partition.

I know of two considerations already:
1. A swap file is easier to change the size of at a later date.
2. Any level of dump of a device (partition) that contains a swap
   file will cause the (large) swap file to be dumped because it
   always changes.

Are there other considerations? Is there a performance difference
between the two methods?

-----------------------

The consensus of 18 responses is that partitions are faster than files
because the disk driver is called directly without having to call the
file system routines first. Opinions varied about how much faster, from
negligible to very significant; the most credible reporters (those
with quotable experts or seminars) aggree that the performance hit is
small (10-20%, 100's of usec out of 10 msec, etc.).

One reporter pointed out that a swap partition is more space efficient
than a swap file because there is no overhead for inodes and such.

Another issue mentioned is security. Some felt that a swap file is
more vulnerable to deletion or modification by malicious users.

I will certainly install a swap partition on the second disk, and then
I can always expand with a file if necessary.

Anyone wishing to receive the complete responses may send a request to
either my address above or below.

-----------------------

Thanks to:

blymn@awadi.com.AU (Brett Lymn)
Casper Dik <casper@fwi.uva.nl>
Tom Reingold <tommy@big.att.com>
ericb@telecnnct.com (Eric William Burger)
jason andrade <jason@ctpm.uq.oz.au>
"Lewis E. Wolfgang" <wolfgang@sunspot@sunspot.nosc.mil>
Barry Margolin <barmar@think.com>
Mike Raffety <mike_raffety@il.us.swissbank.com>
Eckhard.Rueggeberg@ts.go.dlr.de (Eckhard Rueggeberg)
steve@cegelecproj.co.uk (Steve_Kilbane)
pawel@grape.meil.pw.edu.pl (Pawel Marczewski)
sommers@oti-hsv.com (Brian Sommers)
ye@Software.ORG (Jian Ye)
reynolds@icgmfg.mke.ab.com (Michael D. Reynolds)
poffen@San-Jose.ate.slb.com (Russ Poffenberger)
Paul.Bellan-Boyer@dss.fw.gs.com (Paul Bellan-Boyer)
mike@trdlnk.com (Michael Sullivan)
Dan Stromberg - OAC-DCS <strombrg@hydra.acs.uci.edu>

-----------------------

Ned Forrester nforrester@whoi.edu
Applied Ocean Physics and Engineering Dept. / Oceanographic Systems Lab
Woods Hole Oceanographic Institution Woods Hole, MA 02543, USA



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:09:04 CDT