SWAP - how to determine its size?


I notice some swap size descripancy on my two solaris servers. On V4909, I only have one slice for swap and got 15GB swap space. On V440, I have allocated two slices to swap and only get 7.5 GB. Each meta device is a RAID 1. Each slice has the same size (2GB). See details below.

Questions: 1) why adding more meta device on V440 decrease the swap file size? 2) how to determine how much swap space that I need?

Thanks.

V490:
=====
# swap -l
swapfile             dev  swaplo blocks   free
/dev/md/dsk/d1      85,1      16 4111088 4111088

# df -k
Filesystem            kbytes    used   avail capacity  Mounted on
swap                 15930872    1032 15929840     1%    /etc/svc/volatile
swap                 15930576     736 15929840     1%    /tmp
swap                 15929888      48 15929840     1%    /var/run

# metastat d1
d1: Mirror
    Submirror 0: d11
      State: Okay
    Submirror 1: d21
      State: Okay
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 4111104 blocks (2.0 GB)

d11: Submirror of d1
    State: Okay
    Size: 4111104 blocks (2.0 GB)
    Stripe 0:
        Device     Start Block  Dbase        State Reloc Hot Spare
        c1t0d0s1          0     No            Okay   Yes


d21: Submirror of d1
    State: Okay
    Size: 4111104 blocks (2.0 GB)
    Stripe 0:
        Device     Start Block  Dbase        State Reloc Hot Spare
        c1t1d0s1          0     No            Okay   Yes


Device Relocation Information:
Device   Reloc  Device ID
c1t0d0   Yes    id1,ssd@n500000e011d3f900
c1t1d0   Yes    id1,ssd@n500000e011d26e10

V440:
=====
# swap -l
swapfile             dev  swaplo blocks   free
/dev/md/dsk/d1      85,1      16 4100912 4100912
/dev/md/dsk/d8      85,8      16 4100912 4100912

# df -k
Filesystem            kbytes    used   avail capacity  Mounted on
swap                 7525808     992 7524816     1%    /etc/svc/volatile
swap                 7524816       0 7524816     0%    /tmp
swap                 7524856      40 7524816     1%    /var/run

# metastat d1
d1: Mirror
    Submirror 0: d11
      State: Okay
    Submirror 1: d21
      State: Okay
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 4100928 blocks (2.0 GB)

d11: Submirror of d1
    State: Okay
    Size: 4100928 blocks (2.0 GB)
    Stripe 0:
        Device     Start Block  Dbase        State Reloc Hot Spare
        c1t0d0s1          0     No            Okay   Yes


d21: Submirror of d1
    State: Okay
    Size: 4100928 blocks (2.0 GB)
    Stripe 0:
        Device     Start Block  Dbase        State Reloc Hot Spare
        c1t1d0s1          0     No            Okay   Yes


Device Relocation Information:
Device   Reloc  Device ID
c1t0d0   Yes    id1,sd@SFUJITSU_MAW3073NCSUN72G_000616B0D68R____DAN0P640D68R
c1t1d0   Yes    id1,sd@SFUJITSU_MAW3073NCSUN72G_000616B0D5T1____DAN0P640D5T1
# metastat d8
d8: Mirror
    Submirror 0: d81
      State: Okay
    Submirror 1: d82
      State: Okay
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 4100928 blocks (2.0 GB)

d81: Submirror of d8
    State: Okay
    Size: 4100928 blocks (2.0 GB)
    Stripe 0:
        Device     Start Block  Dbase        State Reloc Hot Spare
        c1t2d0s1          0     No            Okay   Yes


d82: Submirror of d8
    State: Okay
    Size: 4100928 blocks (2.0 GB)
    Stripe 0:
        Device     Start Block  Dbase        State Reloc Hot Spare
        c1t3d0s1          0     No            Okay   Yes


Device Relocation Information:
Device   Reloc  Device ID
c1t2d0   Yes    id1,sd@SFUJITSU_MAW3073NCSUN72G_000616B0D5R9____DAN0P640D5R9
c1t3d0   Yes    id1,sd@SFUJITSU_MAW3073NCSUN72G_000616B0D5UE____DAN0P640D5UE

LVL 12
geotigerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NukfrorCommented:
You are seeing the joys of Virtual Memory on Solaris .

On both systems you have approximately 2 GB of *PHYSICAL* swap space.  Everything above that is what's known as *virtual* swap.  Technically, Solaris servers don't need physical swap to run.  Course, most folks wouldn't suggest you try that.  Only on larger RAM systems can you really get away with it.  You're seeing an attribute of the virtual memory subsystem on Solaris.  When the box boots, it mounts up everything includinga attaching the swap area below what's called Anonymous Memory.  Swap space is basically the first contributor what this memory area - but more technically swap is considered to the phsyical back store for anonymous memory.  Part of the system boot up includes flagging a certain percentage of physical memory also as Anonymous Memory.  Hence, the anonymous memory pool gets larger.  Anonymous memory is where paging really occurs.

When your system pages a page out or swaps out a process address space, its actually paging it out to anonymous memory.  When the anonymous memory pool gets consumed (e.g. all the pages are flagged as "paged out"), the physical back store, aka swap, for anonymous memory kicks in.  Pages will start getting phsyically written out to swap space and your system performance begins to drop as swap is hit more heavily.  This is what happens when availabile memory hits a threshold called LOTSFREE.

In short, the 15GB vs 7.5GB is a probably example showing that the V490 has probably twice the amount of physical memory then the V440 does.  Since it does, the V490 is showing more *virtual* swap then the V440 does.  If the machines have the same amount of memory, then the memory subsystem on the V440 is being exercised twice as heavily as the V490.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
yuzhCommented:
Nukfror has given you very good background information about swap space in Solaris.

The size of the swap space is depands what appliaction software is running on the box (the requirements of the system's software applications) and how much RAM the box has.

But you should allocate at least as the SAME size of the RAM for your system, to enable to save a worst-case crash dump.

In most case you can use 2.5 X RAM when you have a large HD, and 1.5 X RAM for small HD.

Have a look at the following page to learn more about Solaris swap space:
http://www.itworld.com/Comp/2378/swol-0496-perf/
http://www.princeton.edu/~psg/unix/Solaris/troubleshoot/ram.html
http://sunsite.uakom.sk/sunworldonline/swol-03-1998/swol-03-perf.html

http://www.alise.lv/ALISE/technolog.nsf/0/59136f9072dc58d8422569fa0057b095?OpenDocument
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.