1823921 Members
2889 Online
109667 Solutions
New Discussion юеВ

Re: Question on swap

 
SOLVED
Go to solution
Etienne Holm
Frequent Advisor

Question on swap

I just inherited a D class box that preforms like 2 legged dog about to die.

The system has 1024 MB of memory
and when I do a swapinfo -t I get the following.

Kb Kb Kb PCT START/ Kb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 49152 0 49152 0% 0 - 1 /dev/vg00/lvol2
dev 512000 0 512000 0% 0 - 0 /dev/vg00/lvol3
dev 409600 0 409600 0% 0 - 1 /dev/vg12/SWAPE1
reserve - 559232 -559232
total 970752 559232 411520 58% -

When I do a top the system only reports 350 MB of memory. Is there a problem with top.

HP did a report for the customer and adviced them to change the prioraty on all the swapchunks to have a prioraty of 1
Currently they are
/dev/vg00/lvol3 ... swap pri=0 0 0
/dev/vg12/SWAPE1 ... swap pri=1 0 0
Is there any benifit in doing it?

I want to add more swap to the system so that I have 1.5 X memory.

Further what will I gain by changing the kernel parameter (swapmem_on 1) currently 0
12 REPLIES 12
Bruno Vidal
Respected Contributor

Re: Question on swap

Hi,
First about top, it is not really accurate, but it is not so bad about memory usage. Take care that it is "used" memory, cf man pages:
Memory Data
Includes virtual and real memory in use (with the amount of memory considered "active" in parentheses) and the amount of free memory.

So in your case 350Mb of memory is in use. Now about swap, using swapmem_on is usefull on really big system, on system like yours, no you will gain nothing to use it (swapmem_on is a sotfware feature to be able to launch more processes than your swap space can handle).

Now it is true that it is better to have the same priority for all swap device, but the best thing is to not swapping at all (if you need to swap your perf will be really bad). In fact you need to add swap only if you need to launch more processes or bigger processes.

Hope this will help.

Cheers.
Tim D Fulford
Honored Contributor

Re: Question on swap

Nooooooooooooo

Do not change /dev/vg00/lvol2 & /dev/vg00/lvol3 to have the same swap priority. swap round robbins among the same priority swap devices. I guess that vg00 is one disk & at least lvol2 & lvol3 are on the same disk(s). This will lead to the root disk(s) being thrashed!!

The second thing, why are you using vg00/lvol3 (/, root directory etc!!!) as swap.

The idea of assigning the same priority to all swap devices is to spread the IO over the devices. If these "logical" devices are on physically different disks it will help, If not you will cause the disk(s) to thrash.

Tim
-
Bruno Vidal
Respected Contributor

Re: Question on swap

Okay, that true that swap is doing round robin fashion in order to find which swap device to use, but what do you care ! If your system is using swap, you're dead and your performance drop dramaticcaly, so I can understand to spread over multiple drives your swap, but really, the priority is not the top priority ;-).

cheers.
Etienne Holm
Frequent Advisor

Re: Question on swap

Like I said I did not build this system I just got it in it's current state. I need to improve it and was interseted to see why HP recommended the prioraty to be 1 on all swap segments
Michael Steele_2
Honored Contributor

Re: Question on swap

Identical priority allows for interleaved swap and enhances performance.

If you have a two disks with swap and one disk is faster then you can assign higher priorities to the swap area associated to that disk for increased performance. But you lose the interleaving. So you have to weigh this.

Secondary swap should be on another disk other than the O/S for better I/O performance, and preferably on another controller as well. This is because the O/S disk will always be the heaviest used and by adding 2ndary swap to this disk you'll be adding to its already heavy burden.
Support Fatherhood - Stop Family Law
Bill Hassell
Honored Contributor
Solution

Re: Question on swap

I would forget about swap as an issue since you aren't using any swap. That's what swapinfo -tm is telling you and the last thing you want to do is to start using swap space, especially if competing programs are constantly paging in and out of swap. vmstat (the po column) will tell you if any page outs are occurring. top's memory line is pretty useless and the reality is that memory management is so complicated (shared libraries, shared exectuables, memory mapped files, buffer cache, shared memory, etc) it doesn't help to look at memory usage except with page-outs in vmstat (hundreds will be bad, single digits are fine).

Instead, focus on what appears to be slow. Is it login response time? If so (and the connections are telnet/rlogin) then fix DNS. Does top show high CPU usage (90% or more)? Then the process(es) that consumes most of those CPU cycles needs help unless that is the way it is supposed to work. If there is only one process that consumes the CPU cycles, then only a faster processor will help. If there are several processes that all consume a lot of CPU, then more processors will help. The D-class has been obsolete for a long time and a new rp-2405 would not only cost less than the original D-class, it would be MUCH faster.

Use sar to look at percentage of user versus system. Anything more than 20-30% system overhead indicates an area that needs attention (wasted systen cycles with bad coding or unnecessary queries that cost a lot of time such as du and bdf).

Most of the work needed to improve performance will focus on applications that need attention. Patches will help, especially if the system hasn't been patched for a few years.


Bill Hassell, sysadmin
Caesar_3
Esteemed Contributor

Re: Question on swap

Hello!

What you see in top it's not the whole memory,
check the dmesg to find the memory.
Swap is not the first that system use,
first came the memory then the use of swap.
If you want to know the problems of your
server you need to check all the hardware
and also the kernel.
Check dmesg, syslog, top, iostat, ioscan,
vmstat also use glance.
You need to check if something wrong with
some device in you system.

Caesar
Wouter Jagers
Honored Contributor

Re: Question on swap

As Bill pointed out already, you are -not- swapping now, and the last thing you want to do is start swapping.

I can understand your D-class performs like a '2 legged dog about to die', however it would be like a one legged dog in a coma when it has to start swapping !

Seeing your relatively low memory usage, there would be no immediate need for you to enable pseudo-swap (the swapmem_on kernel param). Pseudo swap is only useful when you have way more physical memory than swapspace (as in, for example, 4GB memory and 1GB swap).

I guess the performance problem will be a CPU one.. let's face it, it's a D ;-) Again, as Bill already said, get hold of some general release patchbundles. I remember several processes going berserk on my D's over the last few years, all could be fixed with a little patch.

Regards
Wout
an engineer's aim in a discussion is not to persuade, but to clarify.
Etienne Holm
Frequent Advisor

Re: Question on swap

Thanks gusy
well I know Where the problem is but I could not see whay HP will recommend that all swap partitions be chenged to 1 and swapmem_on turned to 1.

I have a fair idea where this system goes wrong. For one it is heavy on user round 50% (very BAD code) Bigg jobs with a single commit at the end.

We are in the process to convince the customer to relpace the box with a new one
first sugestion was a rp2470 but they want a bigger one (rp5470).
T G Manikandan
Honored Contributor

Re: Question on swap

check the values of all the kernel parameters
ALso some parameters with higher values like the semaphore values will bring down the amount of available memory for the user processes

check for the amount of locked memory on the system using

#cat /var/adm/syslog/syslog.log|grep lockable

Bill Hassell
Honored Contributor

Re: Question on swap

The recommendation to set all swap partitions to the same value (1 or 5 or whatever) is based on the round-robin algorithm used by swap allocation. The idea is that you'll use many different paths to different areas of swap which should minimize swap thrashing. However, this is a very simplistic point of view. It is also based on a decades-old idea that some disks are very fast and others are slow (for instance, magneto-optical discs). But if you are swapping so much that the priority is important, your system is alreaady crippled due to lack of RAM. By manipulating swap and using multiple paths, you might reduce a 10 minute job to 8 minutes--but without swapping at all, the job would take 5 seconds to run. In other words, you don't want to cripple your machine with small RAM if you need performance.


Bill Hassell, sysadmin
Michael Steele_2
Honored Contributor

Re: Question on swap

Well, here is the HP document:

http://docs.hp.com/cgi-bin/fsearch/framedisplay?top=/hpux/onlinedocs/B2355-90742/B2355-90742_top.html&con=/hpux/onlinedocs/B2355-90742/00/00/50-con.html&toc=/hpux/onlinedocs/B2355-90742/00/00/50-toc.html&searchterms=interleaving%7cdisk%7cswap&queryid=20030709-205316

And the specific reference:



Guidelines for Setting Up Device Swap Areas



Interleave device swap areas for better performance.

Two swap areas on different disks perform better than one swap area with the equivalent amount of space. This allows interleaved swapping which means the swap areas are written to concurrently, minimizing disk head movement, thus enhancing performance. (See Guidelines for Assigning Swap Priority.)

When using LVM, you should set up secondary swap areas within logical volumes that are on different disks (physical volumes) using lvextend.

If you have only one disk and need to increase swap space, then you should try to move the primary swap area to a larger region.


Similar-sized device swap areas work best.

Device swap areas should have similar sizes for best performance. Otherwise, when all space in the smaller device swap area is used, only the larger swap area is available, making interleaving no longer possible.


The nswapdev tunable system parameter controls the maximum number of swap devices. SAM has more information on tunable parameters.
Support Fatherhood - Stop Family Law