Possible to turn off file system cache?
Posted in 1997
Topics: Stored Procedures & SPL, Platform-Specific Issues, Jobs, Consulting & Announcements
Hi There,
I'm working on a Solaris 2.5.1 machine which appears to be
memory constrained.
When I run sar -r 5 5 I see this:
texas% sar -r 5 5
SunOS texas 5.5.1 Generic_103640-04 sun4u 04/19/97
22:42:39 freemem freeswap
22:42:44 2085 2896453
22:42:49 2110 2896128
22:42:54 2162 2908621
22:42:59 2154 2896875
22:43:04 2160 2902493
Average 2134 2900106
texas%
It only has 2134 pages of freemem.
If I run whatami I see that it has 1gb of ram:
DATE: Sat Apr 19 23:21:14 PDT 1997 <MOVE REQUEST INFO>
USER: oracle <LOGIN = oracle>
MODEL: SUNW,Ultra-Enterprise <MACHINE MODEL = SUNW,Ultra-Enterprise>
CPU: SUNW,UltraSPARC
CPU: SUNW,UltraSPARC
CPU: SUNW,UltraSPARC
CPU: SUNW,UltraSPARC
SunOS RELEASE: 5.5.1
MEMORY: 1024MB
SWAP: 1686.8MB total, 269.2MB used, 1417.5MB available
LOAD AVERAGE: 0.12, 0.14, 0.14
If I look at shared memory used by Oracle I see this:
SVRMGR> show sga
Total System Global Area 216062460 bytes
So, it looks like about 20% of the memory is going to Oracle
as shared memory (aka SGA in oracle parlance).
If I look at processes I see a few large oracle processes which
look like this:
ps -e -o user,pmem,vsz,args | grep oracle
USER %MEM VSZ COMMAND^
oracle 0.2 3032 /u01/app/oracle/product/7.2.2/bin/tnslsnr LISTENER -inherit
oracle 20.7 223584 ora_dbwr_proddb
oracle 20.7 222952 ora_arch_proddb
oracle 21.0 222792 ora_smon_proddb
oracle 20.8 222752 ora_reco_proddb
oracle 21.0 222736 ora_pmon_proddb
oracle 20.7 222912 ora_lgwr_proddb
oracle 0.1 1088 csh
oracle 0.2 1568 -ksh
oracle 0.1 1088 csh
oracle 0.1 832 grep oracle
oracle 0.2 1576 -ksh
texas%
Inspection of the process listing above reveals a question,
"When ps looks at a particular oracle process, is the shared memory
which the process is attached to count towards the memory size of
that process?"
For example, if we look at the listing for ora_dbwr_proddb, we see
that ps believes the size of the process to be 223584 kb.
This is a huge memory size for a process. I can only make sense
of it if I conclude that ps is adding shared memory to private
memory in the display but that the process is not really 223584 kb.
If I want to find the true size of the process I need to subtract
216062460 bytes from 223584 kb to come up with 12586 kb. This is
still a large size for a process but we are talking about an Oracle
process (Oracle software has a rep for being a resource hog).
Actually, now that I think about it, one other scary scenario comes
to mind:
If a process connects to shared memory, that process makes a copy
of that shared memory. Thus, when ps sees such a process it sees
a truely huge process.
This second scenario is so scary, in fact, that I'll ignore it and
concentrate on scenario # 1.
So, I decide to run with this wild guess. If I want to find the true size
of all the processes running, I need to subtract out the size of the
shared memory of all the giant oracle processes.
The following script is helpful:
#! /bin/sh
echo 0>/tmp/dcme
ps -e -o vsz | /bin/awk '{print $0"+" }'|grep -v VSZ>>/tmp/dcme
echo p>>/tmp/dcme
echo q>>/tmp/dcme
dc /tmp/dcme
################################################
When I run it I get the following number:
1439960
So, ps reports that the total memory consumption by processes on this
machine is 1,439,960 kb (which is outrageous).
Next, I inspect /tmp/dcme and notice 6 entries for the huge oracle
processes. So, to adjust the number I multiply 216062460 bytes by
6 and subtract the result from 1,439,960 kb to get:
1,439,960 kb - (216062460*6/1024) kb = 173970 kb
So, it appears that at this moment, all of the process on this
machine consume only 173,970 kb which is about 17 % of the
1gb of ram.
Now the arithmetic gets simple...
Shared memory consumes 20% of the ram
Processes consume 17% of the ram
WHERE is the other 63% of the ram?
I suspect the main clue to the answer lies in the one of my
dusty UNIX books. I think I remember reading that UNIX, like
oracle likes to set up buffers in memory to cache files which
are active.
Could it be that Solaris is devoting 63% of the ram to cache
files which have been opened by oracle?
On this machine I happen to know that all of the oracle data files
are large ufs files rather than raw devices.
Does Solaris have a shell command or gui tool which will tell me
how much ram is devoted to caching the file system?
Does Solaris have a shell command or gui tool which I can use
to tell Solaris to not cache certain files?
-Dan
---------------------------------------------------------------------------
Daniel B. Bikle/Independent Oracle Consultant
dbikle@alumni.caltech.edu | 415/941-6276 | P.O. BOX 1401 LOS ALTOS CA 94023
http://www.rahul.net/dbikle
---------------------------------------------------------------------------