1834116 Members
2333 Online
110063 Solutions
New Discussion

memory and swap

 
SOLVED
Go to solution
Cathy Arora
Frequent Advisor

memory and swap

How can I find out what is current memory on hp-ux 11i box
Once I know the memory what is goof way to calculte swap space instead of using 2Xmemory formula.

Any help is appreciated.
Thamks
raj
10 REPLIES 10
RAC_1
Honored Contributor
Solution

Re: memory and swap

grep - i physical /var/adm/syslog/syslog.log

to get RAM on your system

swapinfo -mat

for swap space configured.
For calculating swap space you need to know few things. Swap is required for every process because if it has to swap there should be space for that. This area is also used as dump area to store crash.(You can configure seperate area for this.)

so swap space at least should be equal to RAM, so in case if it has to swap, the whole contents of RAM will be swapped to swap space.

I personally prefer to put it at 1.5 times RAM.

Also with systems with larger RAM, you can use kernel parameter pseduo_swap and not have 1.5/2 times swap.

There is no substitute to HARDWORK
V. Nyga
Honored Contributor

Re: memory and swap

Hi,

I use this command:
echo "phys_mem_pages/D" | adb /stand/vmunix /dev/kmem|grep phys|tail -1|awk '{printf "%.0f Mb\n",$2/256}'

As a script check the attachment

Swap space:
Well I think the best is still twice memory.

Regards
Volkmar
*** Say 'Thanks' with Kudos ***
Steven E. Protter
Exalted Contributor

Re: memory and swap

Start with swapinfo -tam

It shows current ram and swap.

I'm attaching a script that shows how much physical memory is in each memory slot.

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
A. Clay Stephenson
Acclaimed Contributor

Re: memory and swap

The old 2-3x (4-6x with mirroring) very seldom applies these days. In fact, on boxes with lots of memory, you might even have 0.1 swap or less and the machine runs perfectly with swapmem_on=1 set. I often run boxes with 512MB of primary swap (you must have some) and that's it. Note: Swap should have nothing to do with dump -- those are completely separate things. The best approach is to start with 512MB-1GB or primary swap and monitor the swap usage witk swapinfo and/or Glance. It's so easy to add secondary swap that it's really not worth worrying about.
If it ain't broke, I can fix that.
Cathy Arora
Frequent Advisor

Re: memory and swap

Thanks all.
I get different numbers if i look at syslog and swapinfo -tam. WHy?
However in syslog my meemory is 4096K
and then I looked in sam for allocated swap
that was 2048 megabyes.
so according to the formula I shoud not have swap more than 8 or 9M and I have 2048M
My question is how does huge swap has an impact on performance?
Thanks again
raj
A. Clay Stephenson
Acclaimed Contributor

Re: memory and swap

Here's the deal: With 4GB of memory and 2GB of swap and swapmem_on=0 (no pseudoswap) then you are limited to 2GB of process space. Process space cannot exceed swap space in this scenario. You would need to increase swap to 4GB to fully utilize your system. However, if pseudoswap is in play then total process space is limited to 75% of RAM + swap space or 5GB in your case.

Larger swap spaces have no impact on performance but do allow more processes to run. It's hard to put swap and performance in the same sentence because as soon as you start swapping to any signifant degree then you ain't performing.

You really need to look at the pageout rate (vmstat will show you this) and if it's anything above single digits for significant periods of time-- zero would be nice -- then you are swapping.

If it ain't broke, I can fix that.
Steven E. Protter
Exalted Contributor

Re: memory and swap


I'm attaching a script that will capture performance data for you. The script runs background and collects data in a file.

I've recently gotten a bug out of it.

Calculaing swap space based on the 2x rule might not be the best idea on systems with a lot of memory. People are looking at 1.5 x ram lately depending on how stressed the box it.

swapinfo and syslog calculate memory a little different as A. Clay notes.

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
Cathy Arora
Frequent Advisor

Re: memory and swap

Thanks again. Due to my lack of knowledge I had problem understanding this part -"However, if pseudoswap is in play then total process space is limited to 75% of RAM + swap space or 5GB in your case".
Please explain.

raj
A. Clay Stephenson
Acclaimed Contributor

Re: memory and swap

Okay if the kernel tunable swapmem_on is set to 1, (pseudoswap is enabled) and you have 4GB of real memory + 2GB for swap then
(.75) X 4GB = 3GB
+ 2GB of device swap = a total process space of 3GB + 2GB = 5GB.
If it ain't broke, I can fix that.
Cathy Arora
Frequent Advisor

Re: memory and swap

Sorry it took me while to respond but thanx so much for excellent explaination.

Thanks
raj