Chapter 5.
11
Memory Usage and Page Cache
5.1. Checking the Memory Usage
To determine the size and usage of memory, you can enter the following command:
grep MemTotal /proc/meminfo
You can find a detailed description of the entries in
/proc/meminfo
at
http://www.redhat.com/advice/
tips/meminfo.html
.
Alternatively, you can use the
free(1)
command to check the memory:
$ free
total used free shared buffers cached
Mem: 4040360 4012200 28160 0 176628 3571348
-/+ buffers/cache: 264224 3776136
Swap: 4200956 12184 4188772
$
In this example the total amount of available memory is 4040360 KB. 264224 KB are used by
processes and 3776136 KB are free for other applications. Do not get confused by the first line which
shows that 28160KB are free! If you look at the usage figures you can see that most of the memory
use is for buffers and cache. Linux always tries to use RAM to speed up disk operations by using
available memory for buffers (file system metadata) and cache (pages with actual contents of files
or block devices). This helps the system to run faster because disk information is already in memory
which saves I/O operations. If space is needed by programs or applications like Oracle, then Linux will
free up the buffers and cache to yield memory for the applications. If your system runs for a while you
will usually see a small number under the field "
free
" on the first line.
5.2. Tuning the Page Cache
Page Cache is a disk cache which holds data of files and executable programs, for example pages
with actual contents of files or block devices. Page Cache (disk cache) is used to reduce the number
of disk reads. To control the percentage of total memory used for page cache in Red Hat Enterprise
Linux 3, the following kernel parameter can be changed:
# cat /proc/sys/vm/pagecache
1 15 30
The above three values are usually good for database systems. It is not recommended to set the
third value very high, around 100, as it used to be with older Red Hat Enterprise Linux 3 kernels. This
can cause significant performance problems for database systems. If you upgrade to a newer kernel
like
2.4.21-37
, then these values will automatically change to "
1 15 30
" unless its set to different
values in
/etc/sysctl.conf
. For information on tuning the
pagecache
kernel parameter, see
Understanding Virtual Memory. Note this kernel parameter does not exist in Red Hat Enterprise Linux
4.
The
pagecache
parameters can be changed in the proc file system without reboot:
# echo "1 15 30" > /proc/sys/vm/pagecache
Summary of Contents for CLUSTER SUITE FOR ENTERPRISE LINUX 5.1
Page 7: ...Part I Tuning and Optimizing Red Hat Enterprise Linux for Oracle Database 9i and 10g ...
Page 8: ......
Page 10: ...4 ...
Page 16: ...10 ...
Page 28: ...22 ...
Page 30: ...24 ...
Page 36: ...30 ...
Page 42: ...36 ...
Page 54: ...48 ...
Page 60: ...54 ...
Page 68: ...62 ...
Page 72: ...66 ...
Page 88: ...82 ...
Page 90: ...84 ...
Page 92: ...86 ...
Page 94: ...88 ...
Page 98: ...92 ...
Page 108: ...102 ...
Page 112: ...106 ...
Page 120: ...114 ...
Page 122: ......
Page 128: ...122 ...
Page 132: ...126 ...
Page 134: ...128 ...
Page 142: ...136 ...
Page 146: ...140 ...
Page 156: ...150 ...
Page 160: ...154 ...