Operating System - HP-UX
1827428 Members
3685 Online
109965 Solutions
New Discussion

Re: System is using swap instead of RAM

 
SOLVED
Go to solution
KM_3
Occasional Contributor

System is using swap instead of RAM

Hi all, i have HP-UX11i on rp7410. Its a production server, having oracle 9i installed. I have 8GB of physical memory installed in the machine + 4GB of swap space configured. This is a little background of my machine,

Now my question is not related to the size of swap space or swap configuration, But its abt the memory usage. Oracle is the only application running on her. when i rebooted the system today, & get memory utilization information, it showed me 191MB of swap space under usage (quite ok coz total swap =4GB).
After starting oracle & its related services (like listeners), i once again obtain the memory utilization information. This time swap utalization was 1.3GB & physical memory utilization was constant (under 1GB) as it was before starting oracle database services. It seems to me that Oracle SGA was loaded in swap instead of RAM.

Now question:

1) why she is using swap when there is around 6.5GB-7GB of physical memory(RAM) is still unused. & why there is so heavy utilization of swap.

2)Is there any way to clear swap space instead of rebooting the system.

Regards
Khurram
Knowledge Is Curse
10 REPLIES 10
Fred.Wu
Frequent Advisor

Re: System is using swap instead of RAM

Hi:
when a process reside in memory, a same size of block in swap will be reserved. so if 1.3G memory is in utilization , same size will be reserved in swap.
this amount of space is not really "used" but "reserved".
you can use "swapinfo -at" to check state in swap, it will list how much is used, and how much is reserved.
In this state, release memory can make swap released also.
fred
T G Manikandan
Honored Contributor

Re: System is using swap instead of RAM

THis is what is happening,
Whenever a process executes in memory it reserves the same amount in swap,incase it must be paged out.

That is the reason the swap reservation column is increasing while still you have free memory.

If you have more unused free memory on the system you can try enabled swapmem_on to 1 which will enable pseudo swap.

This will use memory as swap.
This is very useful in reducing the amount of swap on systems with huge amount of memory.

check the memory management white paper at /usr/share/doc/mem_mgt.txt.
Just do a search for "pseudo swap" which will explain you in detail


Thanks
Mike Stroyan
Honored Contributor

Re: System is using swap instead of RAM

When a process first maps a virtual memory region such as a system V shared memory region, the system immediately reserves enough swap to move all that region out to swap. Each page of memory region does not get actual RAM allocated to it until the process actually reads from or writes to an address on that page. When each page is first accessed the system finds a RAM address for it and either fills it with zeros or copies data to it from a mapped file.
Most processes actually access only a fraction of the addresses that they map. The system may also page out some pages from a process if free physical memory is becoming scarce. It chooses pages that have not been accessed recently, trying to keep in the pages that are likely to be used again.
Patrick Wallek
Honored Contributor
Solution

Re: System is using swap instead of RAM

Please post output of 'swapinfo -tam'.

Also with only 4GB of swap, unless swapmem_on is turned on, you will only be able to use 4GB of RAM.
James R. Ferguson
Acclaimed Contributor

Re: System is using swap instead of RAM

Hi:

As Mike has noted, swap is going to be *reserved* when a process allocates memory but has yet to write to it. You can see this reflected in 'swapinfo'. Once this memory is utilized, the *used* component shown in 'swapinfo' will increase accordingly. More importantly if the process free()s the memory it has allocated, *no* change in the used fraction will occur until the process which performed the original allocation actually terminates.

Regards!

...JRF...
Mike Stroyan
Honored Contributor

Re: System is using swap instead of RAM

A page only changes from 'reserved' swap to 'used' swap if it actually needs to be paged out to disk. The 'reserved' total is for all pages that may need to be swapped out, but never have been. The 'used' number is for pages that have actually been moved out to swap at some time. Those pages are mapped to a specific location on a swap device at the time they are first paged out. They keep that swap location even if they are later paged in again.
James R. Ferguson
Acclaimed Contributor

Re: System is using swap instead of RAM

Hi Mike!

Thank you for the correction! I was picturing the 'swapinfo' columns in my head, but obviously not clearly. [ I should have just gone to bed :-)) ] I should have said something like, "Once this memory is utilized, you can see the 'freemem' kernel pool fall if you measure it with 'adb'...".

Regards!

...JRF...
RAJESH GANGADHARAN
Regular Advisor

Re: System is using swap instead of RAM

Hi
Check swapinfo -atm output for reserved, if reserved area is more check whether pseudo swap is enabled (you can find from swapinfo output; check for memory in swapinfo output,) if not enable by tuning the kernel parameter swapmemon to 1. This will reduce the reserved allocation.
If you are using Oracle 9i and Java make sure that you installed all the recommended patches for Java SDK.

-Rajesh
Let the choices you make today be the choices you can live with tomorrow.
RAJESH GANGADHARAN
Regular Advisor

Re: System is using swap instead of RAM

Hi
Check swapinfo -atm output for reserved, if reserved area is more check whether pseudo swap is enabled (you can find from swapinfo output; check for memory in swapinfo output,) if not enable by tuning the kernel parameter swapmemon to 1. This will reduce the reserved allocation.
If you are using Oracle 9i and Java make sure that you installed all the recommended patches for Java SDK.

-Rajesh
Let the choices you make today be the choices you can live with tomorrow.
RAJESH GANGADHARAN
Regular Advisor

Re: System is using swap instead of RAM

Hi
Check swapinfo -atm output for reserved, if reserved area is more check whether pseudo swap is enabled (you can find from swapinfo output; check for memory in swapinfo output,) if not enable by tuning the kernel parameter swapmemon to 1. This will reduce the reserved allocation.
If you are using Oracle 9i and Java make sure that you installed all the recommended patches for Java SDK.

-Rajesh
Let the choices you make today be the choices you can live with tomorrow.