Skip to Main Content
  • Questions
  • Background processes memory consumption

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, Saibabu.

Asked: April 27, 2001 - 11:10 pm UTC

Last updated: January 20, 2005 - 7:47 pm UTC

Version: 8.0.6

Viewed 1000+ times

You Asked

We are using Solaris 2.6 and Oracle 8.0.6 database.There 300 connections are established with database.290 connections are from JDBC 1-0 client.Some of the JDBC connections are as old as 2 months.
We have 1.5Gb swap space.All Oracle background processes are taking 312Mb of memory,which is very abnormal.Even one or two JDBC connections are taking 300Mb memory.We have no idea why it's comsuming this much memory.We are periodically restarting the database to avoid this.Could you please explaing why it's happening,what measures can be taken and in what situations it could happen.
Thanks
Sai.

and Tom said...

It is NOT taking 300 meg of memory. Your SGA is 300 meg I bet. Solaris shows the SGA (SHARED memory) as part of the process memory.

If you have dead clients, you could implement dead client detection at the networking layer. refer to the net8 admin guides for configuration guides on this.

Use pmap to measure how much memory a process REALLY is taking. top, ps, et. al. show you meaningless information when it comes to processes that use shared memory. think about it, 300 processes at 300meg each would be 90,000 meg -- 88 GIG, you don't have that much physical+swap -- it would be simply amazing if your machine actually had 88 gig of memory allocated to processes.

follow up to comment about "not getting it"

I believe I got it -- he said

<quote>
All Oracle background processes are taking 312Mb of memory,which is very abnormal.

Even one or two JDBC connections are taking 300Mb memory.
</quote>

Now, maybe if he just said the first sentence, it could be taken one way or the other (it would be very nice if 300 Oracle background processes took 300 meg of RAM -- my experience is they would take more and 300 meg would be very nice)..

Given the second sentence, it leads me to believe that they are using TOP, looking at line like this:

load averages: 1.15, 1.35, 1.44 07:12:52
145 processes: 144 sleeping, 1 on cpu
CPU states: 95.0% idle, 2.6% user, 1.2% kernel, 1.2% iowait, 0.0% swap
Memory: 2048M real, 119M free, 193M swap in use, 3903M swap free

PID USERNAME THR PRI NICE SIZE RES STATE TIME CPU COMMAND
5241 ora816 1 -14 0 297M 279M sleep 0:02 0.72% oracle
4945 ora816 1 -4 0 297M 279M sleep 0:03 0.42% oracle
5322 ora816 1 -7 0 297M 280M sleep 0:01 0.40% oracle

seeing the 297meg (my SGA is 285 meg) and assuming that process has 297m of ram allocated to it. This question comes up SO FREQUENTLY, that I am very sure this is the case here as well.

The numbers just don't add up -- 300 processes would take more then 300meg so I cannot be 300 meg total.

300 meg / process is way too high, they must be adding in the SGA.


Also, I never said that backgrounds are shown as part of the SGA.

"background processes are not shown as part of Sga.."

that does not even make sense. the SGA is memory -- processes are not part of memory. I said "the SGA (SHARED memory) as part of the process memory". I know that on solaris we are multi-process (i live there, going to windows when I must). I also know that the SGA will show up as part of the process memory in top, ps, and many other utilities. A more in depth tool such as pmap is needed to get to the bottom of memory here.


I stand by the response.



Rating

  (9 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

You Didn't get it i guess?

Usama Munir Dar, April 30, 2001 - 3:12 am UTC

Hi Tom, i don't think u get it, the guy was asking that the background processes ar cummulativly taking 300 megs..not as indviduals? and besides in Solaris the background processes are not shown as part of Sga..they are identified as seperate unlike NT. what do u say?

Great response

Joel, April 30, 2001 - 1:45 pm UTC

Tom,

Good response and good followup. Actually, I found your response to the comment very insightful.

Thanks for the great explanation.

Reader

A reader, May 09, 2002 - 5:42 pm UTC

Tom,

On 8.1.6 system, I did a "ps -efl" and for smon
alone the RSS part of the memory is 9*16k(pagesize) = 144K

On a 8.1.7 system for smon RSS part is 1374*16k = 21 M

Is the RSS part of the processes function of any usage ?
I thought it should be almost constant for a given
version of the database on a given platform

Thanks

Tom Kyte
May 09, 2002 - 7:56 pm UTC

show me the 816 vs 817 output. Not that I don't believe you -- but I don't ;)

ps reports the shared memory segment. use PMAP, not ps.

Reader

A reader, May 10, 2002 - 6:32 am UTC

Tom,

Sorry, I compared the wrong listings. The values of
8.1.6 and 8.1.7 are almost the same. Still 21 M is
bit on the high side, I expected from 1.5 to 2 M

If RSS include shared memory from SGA (DB_BLOCK_BUFFERS
and SHARED_POOL), what is a formuala to estimate how
much of SGA will show up in RSS. Also does memory
pressure has effect on inflating the value
as well

Thanks

Tom Kyte
May 10, 2002 - 6:50 am UTC

PMAP PMAP PMAP PMAP PMAP

there is *no* formula

PMAP PMAP PMAP PMAP PMAP

just use it.

Reader

A reader, May 10, 2002 - 7:39 am UTC

Tom,

Not that I do not want to use "pmap", I like to
understand the effect of usage and memory presure on
"ps -efl" results.

From ixora site
"
The RSS (resident set size) shown by ps is not a valid indication of PGA size. It includes the SGA (db_block_buffers & shared_pool_size) and is sensitive to memory pressure on the system as well as to PGA size.
"



Tom Kyte
May 10, 2002 - 7:47 am UTC

ps is useless in this respect.

use pmap. It is a matter of having to use it if you want anything meaningful. Period.

I basically say the same exact thing as Steve Adams did there.

Reader

A reader, May 13, 2002 - 12:22 pm UTC

SQL*Plus: Release 8.1.6.0.0 - Production on Mon May 13 09:46:59 2002

(c) Copyright 1999 Oracle Corporation.  All rights reserved.


Connected to:
Oracle8i Enterprise Edition Release 8.1.6.0.0 - Production
JServer Release 8.1.6.0.0 - Production

SQL> sho sga

Total System Global Area  109445748 bytes
Fixed Size                   103028 bytes
Variable Size              34533376 bytes
Database Buffers           73728000 bytes
Redo Buffers                1081344 bytes
SQL> !/etc/whodo
Mon May 13 09:47:25 2002
cindy

ttyq0        oracle8   9:45
    pts/0        18860397    0:00 csh
    pts/0        18852790    0:00 sh
    pts/0        18654984    0:00 sqlplus
    pts/0        18224126    0:00 csh
    pts/0        18807234    0:00 whodo
      ?          18835160    0:00 oracle

SQL> !ps -efl|grep 18654984
  0 S  oracle8   18835160   18654984  0  20 20  * 10621:804   1e0dd520 09:46:59 ?       0:00 oracleTEST (DESCRIPTION=(LOCAL=Y
  0 S  oracle8   18654984   18852790  0  20 20  *  1186:489   485af798 09:46:58 pts/0   0:00 sqlplus internal
  0 S  oracle8   18884159   18812778  0  20 20  *   111:52     ee58d20 09:47:49 pts/0   0:00 grep 18654984
  0 S  oracle8   18812778   18654984  0  20 20  *    38:29    5a6798b8 09:47:49 pts/0   0:00 /bin/csh -c ps -efl|grep 18654984


Comment  test1:
--------------
    Here the SGA = 109,445,748 bytes
      The new session shows RSS = 804

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> !vi $ORACLE_HOME/dbs/initTEST.ora


#db_block_buffers        = 9000
db_block_buffers        = 900

SQL> startup
ORACLE instance started.

Total System Global Area   41009780 bytes
Fixed Size                   103028 bytes
Variable Size              32452608 bytes
Database Buffers            7372800 bytes
Redo Buffers                1081344 bytes
Database mounted.
Database opened.
SQL> exit
Disconnected from Oracle8i Enterprise Edition Release 8.1.6.0.0 - Production
JServer Release 8.1.6.0.0 - Production
$ sql

SQL*Plus: Release 8.1.6.0.0 - Production on Mon May 13 09:51:50 2002

(c) Copyright 1999 Oracle Corporation.  All rights reserved.


Connected to:
Oracle8i Enterprise Edition Release 8.1.6.0.0 - Production
JServer Release 8.1.6.0.0 - Production

SQL> !/etc/whodo
Mon May 13 09:51:57 2002
cindy

ttyq0        oracle8   9:45
    pts/0        18860397    0:00 csh
    pts/0        18852790    0:00 sh
    pts/0        18851864    0:00 sqlplus
    pts/0        18850756    0:00 csh
    pts/0        18740862    0:00 whodo
      ?          18842492    0:00 oracle

SQL> !ps -efl|grep 18851864
  0 S  oracle8   18842492   18851864  0  20 20  *  6531:844    5266720 09:51:50 ?       0:00 oracleTEST (DESCRIPTION=(LOCAL=Y
  0 S  oracle8   18851864   18852790  0  20 20  *  1186:483   485af798 09:51:50 pts/0   0:00 sqlplus internal
  0 S  oracle8   18844740   18851864  0  20 20  *    38:29     c1a58b8 09:52:09 pts/0   0:00 /bin/csh -c ps -efl|grep 18851864
  0 S  oracle8   18823671   18844740  0  20 20  *   111:52     8fcdc20 09:52:09 pts/0   0:00 grep 18851864

SQL>

comment test2:
--------------

    In this case SGA = 41,009,780 bytes
    The new session started RSS = 844

The new session shows an increase in RSS when there is a change in SGA. This is waht I wanted to
know how Oracle quantifies it

Thanks
 

Tom Kyte
May 13, 2002 - 2:08 pm UTC

*we don't quantify it*

You are using ps for things beyond it's ability.

I'll say it only once more -- PMAP.

Don't know how else to say it.


Your test takes the SGA from 109,445,748 to 41,009,780, the memory pressures are different -- hence the OS won't page out as much of a process as it did before, hence the resident set size is allowed to be bigger then before.

However -- we, Oracle, have nothing, zero, zippo to do with this -- it is 100% the OS. Pmap is the tool you want. ps isn't very useful in this regards.



PMAP equivalent in HP-UX 11i.

Sankar, January 03, 2004 - 3:45 am UTC

I tried PMAP in HP-UX 11i. It is not there. What is the equivalent one? Any help?



Tom Kyte
January 03, 2004 - 9:16 am UTC

sorry, not an HP/UX user (never seem to get that backspace key working right in my telnet sessions on that os), maybe someone out there is tho and will follow up.

PMAP equivalent in Linux? Thanks.

Reader, January 03, 2004 - 12:05 pm UTC


Tom Kyte
January 03, 2004 - 12:31 pm UTC

</code> http://web.hexapodia.org/~adi/pmap.c <code>

seems to work well.

PMAP equivalent in AIX5L?

A reader, January 20, 2005 - 7:02 pm UTC

Tom,

Do you know the equivalent command for a pmap on AIX5L.

Thanks

Tom Kyte
January 20, 2005 - 7:47 pm UTC

google

pmap aix


i saw lots of hits, i don't use aix.