1851095 Members
2199 Online
104056 Solutions
New Discussion

swap #2

 
SOLVED
Go to solution
Jeff Hagstrom
Regular Advisor

swap #2

Is there a way to monitor swap? We have to boxes, one has 1.5 gig of swap and the other box is being configured for production has 500 meg of swap. I only read in someones notes that the machine should have at least a gig of swap. The machine has 4 gig of memory. Is there away to monitor memory usage?
8 REPLIES 8
James R. Ferguson
Acclaimed Contributor
Solution

Re: swap #2

Hi Jeff:

The standard is with 'swapinfo', 'sar -w' and 'glance'. Take a look at the man pages for 'swapinfo' and 'sar'.

# swapinfo -ta

# sar -w 10 20 #...sample every 10-seconds for 20-samples...

Regards!

...JRF...
Bill Hassell
Honored Contributor

Re: swap #2

swapinfo is the most useful when using the megabyte option:

# swapinfo -tam

(kbytes are just too small these days)


Bill Hassell, sysadmin
Bernie Vande Griend
Respected Contributor

Re: swap #2

The posts above are the methods for monitoring swap. Also, HP recommends having swap space 1.5-2 times the physical memory. Pseudo swap will try to reserve swap space for each process so unless you turn pseudo swap off, 1.5 GB of swap on a system with 4GB physical memory isn't a good idea.
Ye who thinks he has a lot to say, probably shouldn't.
Bernie Vande Griend
Respected Contributor

Re: swap #2

I forgot to attach this, here is a simple script that we use on systems where we are using other monitoring methods. It simply logs the occurence and emails when swap usage is above 90%.
Ye who thinks he has a lot to say, probably shouldn't.
Deshpande Prashant
Honored Contributor

Re: swap #2

HI
swapinfo -tm or glance will be able help you finding out swap utilization on system.
Check output on your system and if system is doing much swaping you can add additional swap in system to improve performance.

In our N4000 machine with 4GB RAM, 1GB swap is working fine.

Thanks.
Prashant .
Take it as it comes.
Bill Hassell
Honored Contributor

Re: swap #2

Actually, the reverse is true about pseudo swap. 1.5Gb of swap is fine in a 4Gb RAM system. Pseudo swap (aka, swapmem_on=1 in the kernel) means that about 3Gb out of the 4Gb will not need swap mapping so the total virtual memory area is 3+1.5 or 4.5Gb of process area.

With pseudo swap disabled, the minimum swap space must be large enough to handle all processes in RAM, or RAM will not be fully utilized. Also, the recommendation of 1.5x to 2x RAM for swap area is quite obsolete. Swap is an overflow area only and ideally should not need to be very large since all processes should fit into RAM at the same time.

Now there are circumstances suh as an interactive information server where users request data infrequently, perhaps once every 5-10 minutes. In this case, you could run a very small RAM size, perhaps 256 megs, and allow 2000 users to login at the same time. When a user needs a sende a request, the process is activated and pages returned back from swap as needed. The time is fast relative to the user's interactive speed so overall performance will be satisfactory even with the small RAM size.

On the other hand, if each process takes 10 minutes to run and need 10 megs of RAM, the 2000 users will cause severe swap thrashing and performance will be unacceptable. As always, it all depends.

But generally speaking, if you have enough RAM, you don't need much swap space at all.


Bill Hassell, sysadmin
Magdi KAMAL
Respected Contributor

Re: swap #2

Hi Jeff,

For production server and better performance,
swap space MUST be from three to four times the amount of physical memory.

So you are really very short to this rule.

Have a look to this book :

O'Reilly
Essential System Administration
2nd esition
Page 315
by Aeleen Frisch

Magdi