1833867 Members
2030 Online
110063 Solutions
New Discussion

Global swap space

 
Ian Jones_1
Advisor

Global swap space

Hi

given this from glance and swapinfo

Swap Device Type Avail Used Priority
--------------------------------------------------------------------------------
/dev/vg00/lvol2 device 1.0gb 0mb 1
pseudo-swap memory 1.5gb 1.4gb na

Swap Available: 2558mb Swap Used: 1433mb Swap Util (%): 96 Reserved: 2457mb

/ # swapinfo -tam
Mb Mb Mb PCT START/ Mb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 1024 0 1024 0% 0 - 1 /dev/vg00/lvol2
reserve - 1024 -1024
memory 1534 1407 127 92%
total 2558 2431 127 95% - 0 -

you can see the "dev" swap has 0% used, but i'm getting error messages saying that Global swap space is low?

is this just a case of increasing swap?
Actual RAM 2GB, swap 1GB
9 REPLIES 9
RAC_1
Honored Contributor

Re: Global swap space

There is nothing wrong with your swapinfo output. All of your swap is reserved. Every process that starts will reserve some swap space, so as to ensure that if it needs to swap out it has space for that.

Also on your system(with 2GB RAM), you won't get any good with setting pseude_swap=1. I think that setting is good for systems with large RAM. I prefer to set it on if RAM is more than 8GB.

You will have to add some more swap space.
lvcreate -C y -L xxxM -r n /dev/vgxx/lvolx

Add it on a different disk and set priority to 1(same as that of primary swap) and put the required entries in /etc/fstab.
Like
/dev/vgxx/lvolx ... swap pri=1 0 0
swapon -a

You will also be required to tune maxswapchunk kernel parameter to reflect added swap space.

Anil
There is no substitute to HARDWORK
Steve Steel
Honored Contributor

Re: Global swap space

Hi

As indicated you are out of swap

There is good info at

Memory Usage - â What is using all of the memoryâ ?

by:eric.herberholz@hp.com

Last modified: July 26, 2004

Latest version available at external ftp site:

ftp://eh:spear9@hprc.external.hp.com/memory.htm




Steve
If you want truly to understand something, try to change it. (Kurt Lewin)
Borislav Perkov
Respected Contributor

Re: Global swap space

Hi,
Everithing points of not enought swap space.
You need to expand your swap space at least twice your phisical memory. This need to be continious swap space. You will have additional problems if you have swap space on different locations of the disk.
Regards,
Borislav
Jeff Carlin
Frequent Advisor

Re: Global swap space

I am having this same issue. Seems that Java on my WebSphere servers reserve tons of swap, but never actually use it.

Set your swap at or larger than your current memory. Get rid of psudeoswap (swapmem_on - turn OFF).

While your at it, you may also want to check your dynamic buffer cache setting. It defaults to 50% of your real memory. I never run my buffer cache over 200-250mb on my servers. This free's up a lot of extra memory. In your case I would set dbc_max_pct in the kernel to something like 11 or 12 (or what you feel comfortable with).
Where wisdom is called for, force is of little use. --Of course, a hammer does wonders for relieving stress.
Don Morris_1
Honored Contributor

Re: Global swap space

Why would you disable pseudo-swap if you're in an over-reservation scenario? That just means you're going to run out earlier than you would otherwise (since if pseudo-swap is on, you get to "reserve" 3/4 or so of it as backing swap for those pages in core).

Which OS is this? What's the max*siz{_64bit} tunable values?
Jean-Luc Oudart
Honored Contributor

Re: Global swap space

Hi,

running out of swap because of the "reserved"
cf. /usr/share/doc/mem_mgt.txt
SWAP SPACE MANAGEMENT
=====================

Swap space is an area on a high-speed storage device (almost always a
disk drive), reserved for use by the virtual memory system for
deactivation and paging processes. At least one swap device (primary
swap) must be present on the system.

During system startup, the location (disk block number) and size of each
swap device is displayed in 512-KB blocks. The swapper reserves swap
space at process creation time, but does not allocate swap space from the
disk until pages need to go out to disk. Reserving swap at process
creation protects the swapper from running out of swap space. You can
add or remove swap as needed (that is, dynamically) while the system is
running, without having to regenerate the kernel.

HP-UX uses both physical and pseudo swap to enable efficient execution
of programs.

Regards,
Jean-Luc
fiat lux
Jeff Carlin
Frequent Advisor

Re: Global swap space

Don, if my server is only reserving swap and not paging, why would you throw swap into active memory? I would rather reserve swap on cheap disk than memory. This free's up to 75% more memory for the processes to run in. Psudeo-swap is pointless on servers with 2gb of memory.
Where wisdom is called for, force is of little use. --Of course, a hammer does wonders for relieving stress.
Don Morris_1
Honored Contributor

Re: Global swap space

Short answer -- Whether 2Gb machines can benefit from pseudo-swap or not depends on the virtual memory requirements of the machine. You could have a workload that mmap's 4Gb sparse arrays and works on 2 or 3 4k pages then moves on to the next pair of arrays... (yes, the coder should really just mmap the file offsets they care about -- but I've seen code like this for scientific computing) for which you'd need 8Gb of disk swap (plus enough for other processes, etc.) Pseudo-swap if you're not paging shouldn't hurt -- and is there to handle the cases where the virtual load is higher than the disk represented virtual addresses available. Long version as to why it shouldn't hurt if you aren't paging already follows....

"Why would you throw swap into active memory?"

That's not how pseudo-swap works. You reserve from "real" swap *first*, with the exception of locked memory [which since it isn't supposed to swap and consumes real physical memory while doing so, it makes more sense to take out of pseudo-swap]. Pseudo-swap should kick in at the point where you'd be getting ENOMEM back from your growth requests because disk swap is exhausted, and allows for RAM pages to be their own swap (up to a percentage of RAM). It doesn't affect the RAM layout at all. (So if you're "throwing swap into active memory" you would have already been failing allocations on the non-pseudo-swap machine -- or you're dealing with memory locking, which means the memory wasn't going to be available to anyone other than the locker in the first place).

In other words -- you start up N processes that reserve all of disk swap and use X physical RAM. (We're going to leave the kernel and lockable mem out of this for simplicity). The core RAM usage is X, the virtual usage is Y (X < Y). IF pseudo-swap is turned off, the next virtual allocation (for process start, heap growth, etc.) fails. That's it, your done. If pseudo-swap is enabled, you then get to allocate an additional .75 * P (where P is physical memory -- and this is an approximation) of virtual space. The additional core usage is Y. If (X+Y) triggers memory pressure, then yes -- you're going to push pages from X to disk and those pages will be competed for. If (X+Y) doesn't trigger memory pressure (suitably less than P) -- the system doesn't do anything differently.

From time to time (every second or so, I believe) the system checks to see if more disk swap has been freed up -- and migrates pseudo-swap pages to being backed by disk to attempt to keep as much as possible on disk.

So if your system is over-reserving and isn't paging, pseudo-swap shouldn't be any kind of problem -- it just increases the virtual address space of the machine. If you are paging (and overreserved), then pseudo-swap does decrease the target environment of pages which can be swapped (which is why VM doesn't allow all of physical memory to be potentially pseudo-swapped) since anything pseudo-swapped doesn't get paged out. But then again, if you're already paging and competing for memory -- your performance isn't going to be that great in the first place.
Kent Ostby
Honored Contributor

Re: Global swap space

Aside from very large memory systems (tens of gigs of RAM), my experience doing support indicates that you still want to approach a number of 2 x RAM worth of device swap.

In some types of database intensive setups, I have seen a need to go with a 3 x RAM setup.

Unless you are running say 20 gigs of RAM, I would start with a 2 x RAM device swap (i.e. since you have 2 GB of RAM, I would recommend 4 GB of device swap).

If that seems too high then I'd at least double it for now or set up some file system swap for a while and see how much of that is used by the system during "normal" operation.

Best regards,

Kent M. Ostby
"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"