SUMMARY: swap and performance

From: Bill Hunter [Intelligent Electronics] (
Date: Thu Aug 13 1992 - 22:41:55 CDT

thanks to the following (and everyone else who replied).
here are the suggestions for max swap performance i received.
most seemed to agree on splitting it between disks and making
both partitions the same size. (sorry if this went out twice).

 Mr T Crummey (DIJ) <> (Gary Burton)
 Jeff Nieusma <stortek!>
 fwp@CC.MsState.Edu (Frank Peters)
 Mike Raffety <> (Russ Poffenberger)
 Christian Lawrence <> (groth curtis a)
 John DiMarco <>
 lm@slovax.Eng.Sun.COM (Larry McVoy)

---------- My Message ---------

dear sun managers,
system is a 4/75 running 4.1.1 with 424mb internal and a
1.3gb external in a mass storage unit.

customer needs to have 150mb swap.

what is the best setup performance-wise with regard to swap.
should it all be one partition or split between two partitions;
one on each drive? should they be equal size? what logic
would provide this answer? the sun documentation says it
will try to utilize both swap partitions equally if there are
two. if one drive were faster than the other, wouldn't this
ultimately slow the faster one down?

------- End of My Message ------
>From: Mr T Crummey (DIJ) <>

Use two equal swap partitions on the two disks. The fact that one disk doesn't
go as fast as the other will not be a problem, since on heavy paging it will
always be quicker if you have two targets to write on. Anyway, I don't think
there is that much difference between the disks. The 424 MByte runs at 4 MB/s
and the 1.3 at 5MB/s.
>From: (Gary Burton)

I have always been told to split the swap space over drives when
possible. We do this on all our unix boxes when possible. You want
to make sure to load balance across your disks so one is not hit
more than the other. Even in the external is slower than the internal
I still feel and have been told by many companies (HP,SUN,DEC,SGI)
that it is better to split the swap space up across disks.
>From: Jeff Nieusma <stortek!>

you want to make sure the swap partition on the boot disk is at least
as big as physical RAM. After that, split the swap between the two
disks because it's always faster to separate data between spindles. As
for making them the same size, I don't think it's going to matter any.
>From: fwp@CC.MsState.Edu (Frank Peters)

First, a restriction. You should have as much swap on drive 0 (the
internal 424 presumably) as you have memory. If you have 64MB of
memory then you should have at least 64MB of swap on that first drive.
Now, the question is, what is the relative performance of the two
drives? Is the external as fast as the internal? It is best to look
at the drive performance specs to find this out. If you don't have
that then a good first approximation is to look at the boot messages
for lines like:
    esp0: Target 3 now Synchronous at 4.167 mb/s max transmit rate
(note that target 3 is disk sd0 and target 0 is disk sd3...such is life)
Look at the max transmit rate.

If the drives are about the same performance then you'll almost
certainly get a performance boost by splitting your swap between the
two drives. I've seen a 4/65 (a 1+) out perform a 4/75 in a memory
intensive application when they had the same amount of memory and swap
but the 4/65 had that swap distributed across three drives and the 4/75
had it all on one drive. That kind of performance boost is probably
unusual but some boost is likely. Suns are fairly intelligent about
spreading the swap load between the two (or more) drives.

On the other hand, Suns can't readily distinguish between two drives of
radically different performance levels. It treats them as if they were
equal and splits the load evenly between them. This can lead to a
degradation if the performance differential is significant enough.

There are a lot of other factors that you might need to take into
consideration though. If the external drive is going to be very busy
(for instance, if it has data for a IO intensive application) then it
may be significantly busier than the internal disk and thus, for swap
purposes, slower.
>From: Mike Raffety <>

You hit it on the nose ... what's the relative performance of the two
drives? If they're about equal, then split swap equally. If one is a
lot faster, put all the important stuff (root, swap, /usr, /var) on it.

The swap algorithm pays no attention at all to the differences in the
swap devices; it treats all of swap as one long flat piece of data. If
you swap partly on local disk and partly on NFS (perfectly valid), you
can get some real strange performance anomalies, depending on where the
swapping/paging algorithms have placed your data.
>From: (Russ Poffenberger)

I do this a lot. It could possible bottleneck a little at the slower drive,
but in your configuration, both the 1.3Gb and the 424 are pretty fast drives.
Also, the bottlenecxk may be offset by less seeking on the drives vs. if you
only had one drive for swap.
>From: Christian Lawrence <>

I suggest you use either :

1 large partition on the fast drive


two equal sized partitions - one on each drive located approximately
in the center cylinders.

In general, swapping is non-deterministic so its not clear that one
drive will slow down the other. If you're concerned about overall
perceived response time then you might make the partition on the faster
drive bigger - but - if this drive is being used heavily for other file
system activity it may not give you what you want either. One thing
you don't want to do is use fragmented partitions on the same drive
(i.e. non-contiguous slices - sd0b, sd0h - swap & sd0g - usr in between).

Bottom line is there are no clear cut rules on how to do this stuff
because disk/controller usage is idiosyncratic; frequency, quantity,
and behavior of applications (and hence swapping) vary; and disks are
always getting faster and more dense. Thats why I suggest the above - do
it now and monitor/analyze later in order to optimize/characterize.
>From: (groth curtis a)

Personally, I would put the entire swap partition (b) on either the
internal only or the external only. Why make it complicated?
>From: John DiMarco <>

Split them. This increases throughput, because one swap partition won't be
significantly affected by traffic on the other.

>should they be equal size?

I don't think so. Put the bigger piece on the faster disk.

>what logic
>would provide this answer?

Guesstimation. Larger part presumably implies used more often.

>the sun documentation says it
>will try to utilize both swap partitions equally if there are
>two. if one drive were faster than the other, wouldn't this
>ultimately slow the faster one down?

Nope. You gain more in splitting the workload between disks than you lose
in having some of your swap on a slower disk.
>From: lm@slovax.Eng.Sun.COM (Larry McVoy)

"sent nice postscript sun performance tuning document"

Because swapping tends to be random access, the limiting factor is
the seek time of the disk. If you use more than one disk for swapping
the sizes of the swap partition should be related to the seek times
of the disks. e.g. There are two disks one 16 ms, one 12 ms. If there is
75Mb swap on the 16 ms disk then you should make a (75*16/12)=100mb swap
partition on the 12ms disk.

On SCSI disks this may not make a lot of difference as SCSI doesn't
do overlapping seeks.

  | ____ ________ /\ |
  | Bill Hunter / // / \\ \ |
  | Sun Systems Engineer/Instructor / //_______/ \ \\ / |
  | Intelligent Electronics /___/________ / \/ / / |
  | 5340 South Quebec Street // / / / \//\ |
  | Englewood, CO 80111 //___________/ \//\ / / |
  | EMAIL: / /________ / / /\ / |
  | DIRECT: 303.779.2657 / // / / \\ \ |
  | CORPORATE: 303.779.6026 /___//_______/ \ \\ |
  | FAX: 303.779.6554 temple of the dog \/ |

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:47 CDT