SUMM: Swap partitions advice & other goodies

From: Guy Dallaire <dallaire_at_total.net>
Date: Fri, 1 Nov 1996 16:55:45 -0500

Thanks agin for your good input.

Here are my original postings, followed by the various replies I got back
from you:

------ ORIGINAL POSTS ----------

Subject: swap partition advice needed

Hello,

I have one 2 Gig disk here that I relabeled with disklabel in order to
provide more SWAP space to my system. I created 2 partitions, 1 of 400Mb for
Swap, and the rest for other use.

I plan to:

1) Add swap (the 400Mb partition)
2) Add the remaining 1.6 Gig to my usr_domain (with addvol domain partition)
which also contains /var. I need to increase the /var/tmp capacity as some
jobs here do HUGE file sorts.

My motives to do so are that actually, SWAP and /usr reside on the same disk
(system) and that putting more swap and more /usr on a second disk will not
dramatically degrade performance.

Am I right ?
Any better solution ?

------

Subject: More questions about swap

Hello,

I have a couple more questions concerning swap configuration.

a) What are the benefits of swap over-commitment mode ?
b) What are the disadvantages of the immadiate mode ?
c) Suppose I have 2 swap partitions, am I right to say that if I put 2
entries in the /etc/fstab file, the next time the machine boots, it will use
both partitions ?
d) Is it true to say that if I use immediate mode and I have two swap
partitions (ex.: /dev/rz0b and /dev/rze10b), I can only have a single link
/sbin/swapdefault pointing to /dev/rz0b and the swap mode will be immediate
on the 2 partitions ?

                                Thanks !

------ REPLIES -----------------

From: Jo Knox <fxjwk_at_aurora.alaska.edu>
To: Guy Dallaire <dallaire_at_total.net>
Subject: Re: Expert advice please

Remember not to let the swap partition begin at sector 0 (unless it's
partition c; the entire disk)!! Should work; I'm doing something similar;
I had a windfall of disks once in the past, and was able to add an entire
disk to usr_domain, an entire disk for swap, and an entire disk for /tmp &
/var/tmp!

NOTE: Using sector 0 in a swap partition results in the disk label getting
destroyed by swap data !

--------

From: alan_at_nabeth.cxo.dec.com
To: Guy Dallaire <dallaire_at_total.net>
Subject: Re: Expert advice please
Date: Fri, 01 Nov 96 13:33:37 -0700
X-Mts: smtp


        It depends on how the I/O load balances out. If it does
        balance, having the second disk should help. Consider
        a load today that is both pageing/swapping and making
        active use of /var. The disk's head will be moving between
        to partitions, which may be close or far. If close, the
        seek time isn't too bad and I/O rate that the disk can
        support is higher. If the distance is far, the seek time
        goes up and the maximum I/O rate goes down.

        If the I/O load is such that the (overall) the system is
        either paging/swapping or doing I/O to /var, then the
        head will tend to stay in one area longer, before having
        to move again and stay in that other area for a while.
        This will allow the I/O rate to be maximized.

        The Digital UNIX page/swap space Allocation method is round-
        robin instead of striping. With many commands allocating page
        and swap space, it will be spread among multiple device, but if
        a single process allocates a large chunk of space it may come
        from a single device. So, your page/swap load may still end
        up on one device or the other in the short term, instead of
        balanced between them.

        AdvFS will also do round-robin space allocation, but file
        space allocation tends to follow the I/O size and it may do
        a better job of spreading a single file among devices. Or
        it may prefer to keep a process's allocation together on the
        same device and only do round-robin for different processes.
        I don't know for sure.

        If the load is balanced and paging/swapping and /var I/O
        happens at the same time, then there is a chance that any
        pair of I/Os will be split between devices. If they're
        on the same device you get back to seek distance being the
        limiting factor for I/O rate. If they're on different
        devices and are localized the I/O rate can be fairly high.
        If they aren't localized, then I/O rate probably won't be
        worse than the single disk case.

        If the load isn't balanced then it little different than the
        single disk case.

        You may want to benchmark the I/O rate on the single disk
        before the shuffle, and then comparible data after to see
        how the load is balanced.

        On a different note; don't put the page/swap space at the
        beginning of the disk. This is where the partition table
        is and the page/swap code will overwrite it.

--------

From: alan_at_nabeth.cxo.dec.com
To: Guy Dallaire <dallaire_at_total.net>
Subject: Re: Other Swap space config questions
Date: Fri, 01 Nov 96 13:39:04 -0700
X-Mts: smtp


        a. Over-commit allows the total system virtual memory
            to be limited only by the sum of available memory
            and page/swap space. The disadvantage is that if
            there isn't enough the dead-lock prevention method
            starts killing off idle processes. It takes a very
            liberal view of "idle" in extreme shortages.

        b. You only run out of page/swap when you try to allocate
            virtual memory, not after. There won't be dead locks.

        c. Yes. You can also add partitions dynamically using
            swapon.

        d. No, sort of. The device at the other end of the link
            will be used until swapon is run to add the other devices.
            Immediate vs. Over-commit only refers to whether space
            is reserved vs. not reserved when virtual memory is
            created. Processes started before swapon is run will
            get their space allocated to the only known device, but
            after the space will be distributed.

--------


Date: Fri, 1 Nov 1996 15:46:23 -0500 (EST)
From: BigRedDog <ckrieger_at_latrade.com>
X-Sender: ckrieger_at_humat.dev.latrade.com
To: Guy Dallaire <dallaire_at_total.net>
Subject: Re: Other Swap space config questions

> a) What are the benefits of swap over-commitment mode ?

You have more swap space available to your programs as a general rule.
The over-commitment mode is sort of like statistical multiplexing. It
counts on the fact that while any program may at any time actually use
the amount of space requested, about 90% of the time it is only using a
fraction of that space. Every once in a while this can result in not
enough swap space. I personally use this mode on all but mission
critical machines.

> b) What are the disadvantages of the immadiate mode ?

Immediate modes main draw back is that it ties up swap space and makes it
unavailable to other processes, even if it is not in use by the
application that has reserved it.

> c) Suppose I have 2 swap partitions, am I right to say that if I put 2
> entries in the /etc/fstab file, the next time the machine boots, it will use
> both partitions ?

My fstab entries are like this:

/dev/rz3b swap1 ufs sw 0 2
/dev/rz10b swap2 ufs sw 0 2
/dev/rz0c swap3 ufs sw 0 2

swapon -s shows this:

Swap partition /dev/rz3b:
    Allocated space: 32768 pages (256MB)
    In-use space: 13390 pages ( 40%)
    Free space: 19378 pages ( 59%)

Swap partition /dev/rz10b:
    Allocated space: 32044 pages (250MB)
    In-use space: 13888 pages ( 43%)
    Free space: 18156 pages ( 56%)

Swap partition /dev/rz0c:
    Allocated space: 25612 pages (200MB)
    In-use space: 13136 pages ( 51%)
    Free space: 12476 pages ( 48%)


Total swap allocation:
    Allocated space: 90424 pages (706MB)
    In-use space: 40414 pages ( 44%)
    Available space: 50010 pages ( 55%)

> d) Is it true to say that if I use immediate mode and I have two swap
> partitions (ex.: /dev/rz0b and /dev/rze10b), I can only have a single link
> /sbin/swapdefault pointing to /dev/rz0b and the swap mode will be immediate
> on the 2 partitions ?

Just have it point to the first one, and you will be fine.

Hope this helps,


--------

Date: Fri, 1 Nov 1996 13:03:28 -0800 (PST)
From: Steve VanDevender <stevev_at_hexadecimal.uoregon.edu>
To: Guy Dallaire <dallaire_at_total.net>
Subject: Other Swap space config questions
References: <1.5.4.16.19961101145404.36f71f5c_at_pop.total.net>

a) What are the benefits of swap over-commitment mode ?

You typically use less swap with the same number of processes, and less
swapping occurs.

If you have a process that has sparse virtual memory usage (i.e. a large
address space but only a few pages get touched) then often those will
only work well in swap over-commitment mode. Otherwise you may need
enough swap to cover the total virtual address space the process wants,
rather than enough swap to cover the pages the process actually uses.

Swap over-commitment mode may be less reliable on a heavily loaded
machine. If a process needs a large amount of swap that isn't
available, it will generally be killed by the kernel right away. In
over-commitment mode the kernel sometimes just starts killing other
processes pseudo-randomly until enough swap is available.

b) What are the disadvantages of the immadiate mode ?

Larger swap usage, more frequent swapping, and slower performance for
typical applications under most circumstances.

c) Suppose I have 2 swap partitions, am I right to say that if I put 2
entries in the /etc/fstab file, the next time the machine boots, it will use
both partitions ?

If you add a second swap partition you may not need to reboot to
activate it; just use 'swapon' to add it. If you specify multiple swap
partitions in /etc/fstab then they are all activated at boot time, as
the startup scripts do a "swapon -a". However, you cannot _remove_ a
swap partition from use without taking it out of /etc/fstab and
rebooting.

"swapon -s" will show you all the swap partitions currently in use.

d) Is it true to say that if I use immediate mode and I have two swap
partitions (ex.: /dev/rz0b and /dev/rze10b), I can only have a single link
/sbin/swapdefault pointing to /dev/rz0b and the swap mode will be immediate
on the 2 partitions ?

As far as I know swap over-commitment is either on for all swap
partitions or off for all swap partitions; you can't have a mixture.


Guy Dallaire
dallaire_at_total.net

"God only knows if god exists"
Received on Fri Nov 01 1996 - 23:27:47 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:47 NZDT