1834757 Members
3444 Online
110070 Solutions
New Discussion

badly configured swap

 
Ulrich Tehrani
Advisor

badly configured swap

Hi,

a few weeks ago i start a sysadmin job at a new company.


I think swap is badly configured from the former sysadmin. I need some advices to make a good configuration:

Physical memmory:

dmesg | grep -i physical


bsl61h:/#dmesg | grep -i physical
physical page size = 4096 bytes, logical page size = 4096 bytes
Physical: 6291456 Kbytes, lockable: 4789104 Kbytes, available: 5506124 Kbytes

Swap:

bsl61h:/#swapinfo -ta
Kb Kb Kb PCT START/ Kb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 2097152 0 2097152 0% 0 - 1 /dev/vg00/lvol2
dev 2048000 188276 1859724 9% 0 - 0 /dev/vg05/lvol5
reserve - 2306572 -2306572
memory 4865520 4865520 0 100%
total 9010672 7360368 1650304 82% - 0 -


I think this isn't a good configuration:

6GB physical memmory and only 3.95 GB RAM. Shall I add some device swap? I think swap space must have at least the same size as physical swap ?
Extend swap on /dev/vg05/lvol5 to 2 GB and add further 2GB

As you can see from the output the swap devices have different priorities. For the interleaving I have to change priority in /etc/fstab. Or ?


Kernel Parameter:


allocate_fs_swapmap 0
maxswapchunks 2072
nswapdev 10
nswapfs 10
remote_nfs_swap 0
swapmem_on 1
swchunk 2048

With a further swap device i have to adjust the kernel parameters (currently 2072 x 2 MB = 4144 MB = 4.04 GB) to reach 6GB
That's right ?

How can give me some advices.


Thanks in advance


Uli

4 REPLIES 4
John Bolene
Honored Contributor

Re: badly configured swap

It all depends on what you are running.

If you have swapmem_on = 1 and dbc_max_pct = 5 (or 4), then it may not matter about the disk swap as you will be putting almost everything in memory.

What are the settings I mentioned, what types of applications are you running, and what does your memory usage look like now?
It is always a good day when you are launching rockets! http://tripolioklahoma.org, Mostly Missiles http://mostlymissiles.com
Steven E. Protter
Exalted Contributor

Re: badly configured swap

Your swap utilization is pretty low actually, which means you probably aren't pushing your system very hard.

There are various strategies on swap. I was told at HP classes set it to a total of twice physical memory up to 16 G of ram.

Some of the vets here now say 1.5 times physical memory.

I remember JRF or someone recommending one small primary swap area and a large secondary one adding up to 1.5 times physical memory.

This was supposed to provide better performance. Most of the time only that small fast primary swap area ever got used.

Lots of strategies, no firm rules.

I am attaching a performance monitoring script that could help you gather information you need to make good decisions.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Jdamian
Respected Contributor

Re: badly configured swap

in this case I would:

1. increase 'maxswapchunks' to 4096 (8 GB) in order to prevent recompile the kernel again in the future.

2. run 'ipcs -ma' to see the shared memory areas.

3. create new logical volumes to add new swap areas up to 6 GB as you suggested or much more according to applications running.

4. check dbc_max_pct.
Michael Steele_2
Honored Contributor

Re: badly configured swap

Since your Total swap percent utilized is close to 85%, which is the ceiling, I would add more swap:


total 9010672 7360368 1650304 82% - 0 -

But swap needs to be contiguous and this may prevent you from extending /dev/vg05/lvol5.

You don't have to reboot if maxswapchunkcs is ok, so first try adding in another logical volume configured for swap.

NOTE: All priorities must be equal to 1! This is set in /etc/fstab for swap other than /dev/vg00/lvol2.

Here is the procedure:

lvcreate -L #### -n swap -C y -r n /dev/vg##

NOTE: -L = mb

swapon -f -p 1 /dev/vg##/swap

'swapon' may not complain if maxswapchucnks is OK. If it doesn't like maxswapchuncks then it will tell you.

maxswapchunks = total swap / 1024 * swchunk

sysdef | grep -i maxswapchuncks

sysdef | grep -i swchunck

/etc/fstab
/dev/vg##/swap ... swap pri=1 0 1
Support Fatherhood - Stop Family Law