1753259 Members
5648 Online
108792 Solutions
New Discussion юеВ

Re: Out of memory issue

 
mehul_3
Regular Advisor

Out of memory issue

Hi all
Following result is shown after executing swapinfo
# swapinfo -atm
Mb Mb Mb PCT START/ Mb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 6144 305 5839 5% 0 - 1 /dev/vg00/lvol2
dev 6144 310 5834 5% 0 - 1 /dev/vg00/lvol9

reserve - 11641 -11641
memory 2314 1269 1045 55%
total 14602 13525 1077 93% - 0 -

There are two typical questions that should be answered in hassle-free way
1) Why reserve memory is shown in advance if it will not use in real time execution consuming a lot of memory?
2)If number of oracle concurrent session(active+Inactive)is exceeded more than 300+ then I confront this type of problem showing more reserve memory and getting "Out of memory" error. Our architcure is three-tier based using as middle-ware as application server and oracle9i as backend
I am really surprised if suppose number of session is 10000+ in web based application would require more and more physical memory. Is it so?

I am facing this problm in regular interval
waiting for reply

Regards,
Mehul
5 REPLIES 5
Steven E. Protter
Exalted Contributor

Re: Out of memory issue

Shalom,

1) When a process is started it reserves swap, just in case it needs to be swapped from memory to disk. Seems the processes are consuming more memory per process than you think. Oracle also uses shared memory, you have have a problem with shmmax and/or shmseg kernel parameters.

2)Could be a a shared memory problem, but I recommend the following approach:
a) See if there are Oracle patches for excessive memory consumption or memory leaks.
b) See if the OS is properly patched to a recent bi-annual patch update.
c) See if all requires OS patches for oracle are installed (metalink). If not, install them and relink oracle

ipcs to analzye and prossibly increase shared memory.

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
mehul_3
Regular Advisor

Re: Out of memory issue

shared memory like shmmax and/or shmseg are perfectly set as per oracle recommendation.



Regards,
Mehul
Dennis Handly
Acclaimed Contributor

Re: Out of memory issue

>shared memory like shmmax and/or shmseg are perfectly set as per oracle recommendation.

You only have about 2 Gb of memory, what does Oracle say about that and the size of shmmax?

mehul_3
Regular Advisor

Re: Out of memory issue

I have a 3GB of memory

Regards,
Mehul
Don Morris_1
Honored Contributor

Re: Out of memory issue

You're not reserving memory -- you're reserving *swap*. They aren't the same thing. HP-UX requires all virtual address space allocations (which is what you're really doing when you create a new SysV object, do malloc(), mmap() a file, etc.... you don't use actual memory until you really touch something) to pre-reserve the corresponding amount of swap. The reason for this is to have clear points of failure so applications can handle things properly (aka system stability).

In the normal HP-UX model... you allocate virtual memory, which means you reserve swap. You touch some random addresses, get physical memory... the system comes under pressure, and the kernel decides it needs to page out some of your pages... so it needs the equivalent swap to do it... which was reserved, so it will be available... and things keep running.

In the "Lazy Swap" model... you allocate virtual memory, and swap is only reserved when you touch an address and need to get physical memory. Now you have a couple choices... you could not get swap at all -- and instead try to find some at the time of paging [if ever]... which would mean that you could easily overcommit the system and either have your applications randomly killed or your box hang when the kernel can't find swap and freemem is exhausted, or you could get swap at the time of RAM allocation to match the physical memory consumed... which means you'd have to either block for swap [potentially forever since you'd really be waiting for applications to go away or an admin to add more swap] or much more likely, have the allocation itself be failed... resulting in SIGSEGVs on random faults within your application (again, your application appears to randomly die). And in case you're wondering, there is no kernel tunable to put HP-UX in any Lazy Swap model (there is a flag to mmap() which can request per-allocation Lazy Swap, and a chatr flag... but that's it -- and you're risking random application failure as I mentioned if you use it).

The "memory" line in swapinfo is not RAM per se, it is pseudo-swap and simply means that when the normal swap areas are fully reserved, the system will allow a percentage of memory allocations to swap to themselves [which ones exactly would only be known when actual paging occurred and all the swap devices get USED instead of reserved]. It is not your application's RAM consumption... rather another sign that your virtual address space for your workload is higher than your configured swap space.

As others have pointed out, there are kernel tunables that can be used to throttle your application's virtual object creation (and therefore the swap reservation). You'll want to balance your intended workload using these limits and adding more swap [only you know what you really want to provide.. and only you know if your workload is truly sparse... if it isn't and your workload can spike and consume lots of physical memory, you're likely to get into a paging frenzy when all these oracle sessions start exhausting your 3Gb of memory].