Swap space and OW3.0 SUMMARY

From: Bernard Silver (bs30%sirius@gte.com)
Date: Mon Nov 18 1991 - 19:40:22 CST


My original message:

===============================================================
        The documentation for Openwindows 3.0 claims that you
        need at least 2.5 as much swap as physical memory.
        (We have previously heard you need at least the same,
        and for good performance 3 times, so this is in line.)

        All of our machines have 64MB of memory, so the swap requirement
        is quite high.

        A few questions:

        a) Do you really need this much swap?

        b) Is there a problem with creating a large swap file,
        rather than repartioning the disks (i.e. is there a problem
        with having several swapping areas).

        c) Someone asked recently about the advantages/disadvantages
        of swapping files versus swapping partitions. I didn't
        see any discussion on this.

===============================================================

Thanks to:

leo@ai.mit.edu (Leonardo C. Topa)
John Hasley<hasley@andy.bgsu.edu>
mdl@cypress.com (J. Matt Landrum)
deltam!dm!mark@uunet.UU.NET (mark galbraith)
Jay Plett <jay@silence.princeton.nj.us>
Russell Brand <wuthel!brand@lll-winken.llnl.gov>
lee@sqlee.sq.com (Liam R. E. Quin)
mikulska@ece.UCSD.EDU (Margaret Mikulska)
bzs@world.std.com (Barry Shein)
stern@sunne.East.Sun.COM (Hal Stern - NE Area Tactical Engineering)
knutson%sw.mcc.com@mcc.com (Jim Knutson)

                Summary.

(Someone asked where the quote was: page 2 of the Installation
and startup guide: "You must have swap space that is at least 2.5
times the amount of main memory".)

First of all, there was major agreement that while a piece of
software can have certain memory requirements, it is strange
for OW to require a certain swap to physical memory ratio!
OW3.0 requires at least 8MB of memory, although "For improved
performance, 12288K or 16384K are recommended" (also page 2).
So, perhaps 3*8, or 3*12 or 3*16 is enough.

Do I need the swap space? The general consensus was no.
You certainly need at least physical memory, and then you
need what you need! Two examples:

Hal Stern (of Sun) said:

(a) you may or may not need that much swap. the "3x memory"
        requirement is a little large if you have > 16M
        in your machine. i think this is meant more for the
        16-32M configurations. you should try summing your
        current swap space usage by adding the SZ columns
        in a long ps listing of all processes running when
        you're "full blown" in OWN. the SZ fields show
        how large your stack/heap are -- those are the only
        parts of a process's address space that consume
        swap space. alternatively, you can use pstat -T,
        although the ps listing will let you do a little
        bit of "what if" planning

Jay Plett said:

        Do "/usr/etc/pstat -s" on your workstation when it is running
        everything it might ever need to run at any one time.

        7596k allocated + 4320k reserved = 11916k used, 21776k available
        -----------------------------------^^^^^^

        That is how much swap space you need. There is no direct
        relationship between physical memory and swap space. You
        need enough swap space to map the address spaces of all
        processes that are running simultaneously. When you run
        out of swap space, new programs will not execute and running
        programs will not be able to dynamically allocate additional
        memory. You will never be in doubt if you have inadequate
        swap space. The amount of swap space has no affect whatsoever
        on performance. The amount of physical memory can have a
        dramatic affect on performance. The results of inadequate
        physical memory aren't so easy to determine; the seat of
        your pants is probably the best yardstick. As a general
        rule, I like to have 30-50% more physical memory than
        the number highlighted above, when a machine is running
        under ordinary circumstances (as opposed to maximum needs
        as with swap space).

Liam R. E. Quin gave another way to size your swap requirements.
BUT: SEE HAL STERNE'S ADVICE AGAINST THIS AT THE END OF THIS MESSAGE!!!

        A good way to do this is to have (say) a 30M swap partition,
        and then to use mkfile to create a small file, add it with
        swapon, and see how big it gets. You use the -n option to
        mkfile to do this, I think, or you may be able to give swapon
        an empty file. Then after a month or two see how big the
        files got, and decide what to do from there.

For part b:
I was using 4 swap partitions on two disks, and suspected that
this was bad, and I didn't really want to add another swapping
area to accomodate OW3.0 apparent requirements.

Everyone agreed that interleaved swapping on two disks is better than
swapping on just 1. But don't put multiple swap partitions on one disk.

Leonardo C. Topa said:

        At least on scsi buses, it's actually better to partition your swap
        area evenly across multiple disks, you get almost the effect of
        parallel processes. To put more than one swap area on the same disk
        has the opposite effect. If I recall correctly, Hal Stern discussed
        this in details some time ago.

Barry Shein pointed out:

        Suffice it to say that if you're swapping much you'll be unhappy for
        even very good disk performance, so take comments about slight
        differences in performance between the two with a grain of salt (e.g.
        if it takes 10 microseconds to find a page in physical memory and 2000
        microseconds to have one ready from one swap type but only 1850 from
        another swap type what conclusion do you draw? HAVE ENOUGH MEMORY,
        virtual memory is real disk, as DEC used to say, tho that was the
        standard retort to "gee, you mean I can have a 1GB process on a
        VAX!?")

Part c:
The consensus was that swapping to partitions is going to be slightly faster
than swapping to a file, as the file system doesn't have to be accessed.

Hal Sterne said:
        depending upon the size of the swap file, going to a swap file in
        the UFS filesystem may be slightly slower than a raw disk.
        you have to go through the filesystem to get to the
        appropriate block of the swap file, but for the most part
        the inode for this file will already be in-core.

He added this warning:
        if you do use a file for swapping, do *not* create it with
                mkfile -n
        make sure you allocate all of the blocks for the file (the
        default mkfile behavior) so that you don't go to swap or page
        out a process and find that the disk has filled up.

Thanks to everyone for their comments.

                                Bernard Silver
                                GTE Laboratories
                                bsilver@gte.com
                                (617) 466-2663



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