Swap File vs. Swap Partition - which is better?

Swap File vs. Swap Partition - which is better?

Post by Unixrul » Fri, 15 Jun 2001 01:03:05



This toipic has probably been covered before, but can anyone add there 2
cents here for a discussion we're having in-house?
Which provides better eprformance and why:  a swap file or a swap partiton?

Here are my reasons- tell me if I'm all wet:

The disadvantage to setting up a swap file is that it is considered a file
within a file system, therefore, when backing up a file system, a rather
large swap file (empty file) would also be backed up if you don't
specifically exclude it.

Also, because a swap file is simply a file in some file system, you will not
ever be able to unmount that file system while the swap file is in use.

Finally, which type of swap area provides the best performance: a swap
partition, or a swap file.   I've seen reasons stated in favor of both
scenarios, however, one of the best I've seen in favor of a swap partition
is that a partition provides contiguous space and can be positioned between
specific cylinders that will provide the best performance.

Any thoughts or things to add?

 
 
 

Swap File vs. Swap Partition - which is better?

Post by Rich Tee » Fri, 15 Jun 2001 02:55:48



> The disadvantage to setting up a swap file is that it is considered a file
> within a file system, therefore, when backing up a file system, a rather
> large swap file (empty file) would also be backed up if you don't
> specifically exclude it.

Yes, that would be the case.

Quote:> Also, because a swap file is simply a file in some file system, you will not
> ever be able to unmount that file system while the swap file is in use.

Also yes.

Quote:> Finally, which type of swap area provides the best performance: a swap
> partition, or a swap file.   I've seen reasons stated in favor of both

I don't think there's much to choose between the two here.  The main
thing to keep in mind is that having more than one swap file/partition
on a spindle will really kill performance once you start swapping.

So yes, using a dedicated swap partition is the better way to go,
making sure that each disk only has one swap partition on it.  I
view swap files as a quick and dirty fix to get you going while
you wait for another drive to come in for the more permanent home
for the extra swap space.

--
Rich Teer

President,
Rite Online Inc.

Voice: +1 (250) 979-1638
URL: http://www.rite-online.net

 
 
 

Swap File vs. Swap Partition - which is better?

Post by Vadim V. Kouevd » Fri, 15 Jun 2001 02:56:21


I doubt you have sofisticated crashdump handling system with shared
dump devices... Therefore you will need to have some local dump
device - either swap or additional (wasted for dumps only) partition.

Perhaps you could handle it through flat file as follows (size of
file must be surely much bigger):

abdep3:root # mkfile 50m swap
abdep3:root # swap -a /opt/swap
abdep3:root # swap -l
swapfile             dev  swaplo blocks   free
/dev/dsk/c0t0d0s1   136,1      16 263072 262960
/opt/swap             -       16 102384 102384
abdep3:root # dumpadm -d /opt/swap
      Dump content: kernel pages
       Dump device: /opt/swap (swap)
Savecore directory: /var/crash/wtest-28-srv1.is.bear.com
  Savecore enabled: yes

But I have never seen that and am not sure it will work at all.

Of course, if you don't care of crash dumps, you wasted your time
reading this post.

--

Bear Stearns       Engineering Task Force       ITG UNIX


> This toipic has probably been covered before, but can anyone add there 2
> cents here for a discussion we're having in-house?
> Which provides better eprformance and why:  a swap file or a swap partiton?

> Here are my reasons- tell me if I'm all wet:

> The disadvantage to setting up a swap file is that it is considered a file
> within a file system, therefore, when backing up a file system, a rather
> large swap file (empty file) would also be backed up if you don't
> specifically exclude it.

> Also, because a swap file is simply a file in some file system, you will not
> ever be able to unmount that file system while the swap file is in use.

> Finally, which type of swap area provides the best performance: a swap
> partition, or a swap file.   I've seen reasons stated in favor of both
> scenarios, however, one of the best I've seen in favor of a swap partition
> is that a partition provides contiguous space and can be positioned between
> specific cylinders that will provide the best performance.

> Any thoughts or things to add?

 
 
 

Swap File vs. Swap Partition - which is better?

Post by Kenneth Sible » Mon, 18 Jun 2001 12:58:53



Quote:> This toipic has probably been covered before, but can anyone add there 2
> cents here for a discussion we're having in-house?
> Which provides better eprformance and why:  a swap file or a swap
partiton?

> Here are my reasons- tell me if I'm all wet:

> The disadvantage to setting up a swap file is that it is considered a file
> within a file system, therefore, when backing up a file system, a rather
> large swap file (empty file) would also be backed up if you don't
> specifically exclude it.

> Also, because a swap file is simply a file in some file system, you will
not
> ever be able to unmount that file system while the swap file is in use.

> Finally, which type of swap area provides the best performance: a swap
> partition, or a swap file.   I've seen reasons stated in favor of both
> scenarios, however, one of the best I've seen in favor of a swap partition
> is that a partition provides contiguous space and can be positioned
between
> specific cylinders that will provide the best performance.

> Any thoughts or things to add?

A swap partition is much better and the main reason in addition to being
able to
position it on the disk is that the swap partition does not go through the
filesystem
reads and writes.  It is all raw i/o which gives much better performance.
It is
even better if you stripe it across multiple spindles, but make sure you use
the
same size space on each disk.

Ken Sibley

- Show quoted text -

 
 
 

Swap File vs. Swap Partition - which is better?

Post by Rich Tee » Tue, 19 Jun 2001 08:33:59



> A swap partition is much better and the main reason in addition to being
> able to
> position it on the disk is that the swap partition does not go through the
> filesystem
> reads and writes.  It is all raw i/o which gives much better performance.

I don't think swap reads and writes go through the UFS code anyway, even
if it's a swap file on a UFS filesystem.

Quote:> It is
> even better if you stripe it across multiple spindles, but make sure you use
> the
> same size space on each disk.

Agreed - although the spindles can be of mixed sizes with problem.
Solaris round robins between all available swap devices/files, no
matter what their respective sizes.

--
Rich Teer

President,
Rite Online Inc.

Voice: +1 (250) 979-1638
URL: http://www.rite-online.net

 
 
 

1. MS-DOS Swap File vs. Swap Partition

Hello, All;

What performance difference, if any, should I expect to see between a
native Linux swap partition and a swap file residing on an MS-DOS
partition?

I'm currently using my Microsoft Windows swap file as a Linux swap
file, and I'm considering adding a dedicated Linux swap partition as
well.  If there's no performance benefit, I may as well just use a
larger Windows swap file.

Bruce

2. The Linux Journal on "Safari"

3. Swap file VS Swap partition

4. storage on HAS

5. swap file vs swap partition

6. HELP PLEASE!!! gtk and imlib

7. swap partition vs swap file

8. apt-get and dpkg broken

9. Swap partition vs Swap File

10. Swap file VS Swap partition

11. Swap partition vs. dynamic swap performance tradeoff?

12. Linux Swap Partition and Win3.1 Swap File

13. swap file instead of swap partition