We recently upgraded our Oracle Ebusiness Suite R12.1.3 Production database from version 11gR1
to 11gR2. Post the upgrade, the support team looked at the memory
usage on the servers and we were quite concerned to see consistent memory usage
of over 90%. Obvious potential reason was this might be due to database upgrade
over the weekend. So a deep dive was done and after detailed analysis we found
out it was non-issue.
Basically in
order to increase the performance, Linux server reserves some of unused memory
for disk caching. From the commands it may seem there there is hardly any free memory
available. Actually it is reserved by the OS and hence it shows as in use however
when required it can quickly release the required memory. Essentially the
server may not be low on memory.
Below are the commands I used to look at memory consumption on a Linux
server and were executed on Red Hat Linux 5.10
"free" command
The
‘free -m’ command shows the memory usage in Mega Bytes.
Refer to the Memory values shown in red
colored rectangle below. The Free Memory
1446 MB is quite low and used Memory 95210 MB is quite high. This is because
the memory is held for caching purpose in order to improve the performance
The
real indication of used and free memory is as depicted in green rectangle below.
It shows how much memory is completely unused 10757 MB and free 85899 MB,
as the memory used by buffers/cache can quickly be allocated to any programs should
it be required.
The free
command will also show used and free swap usage, ideally 0 swap should be used,
meaning that nothing has been swapped out from physical memory to hard disk. If
this value is higher than 0, then memory usage as it may have filled up and
spilled over to disk at some point. In our above example we have 0 swap usage
If swap fills
up then find out the cause of swap usage or increase the swap disk space or add
memory.
“top” command
The most popular way to find real time resource usage on servers is the use of top command. Using top command also show swap space usage, load average. us how much swap space is available including how much is in use and free.
These values marked
in red box below include memory used by
buffers and cache, similar to the first line shown in the ‘free’ command. In-effect
it does not give a true picture of memory usage.
To view the
top output sorted by memory click Shift+M key.
‘vmstat’ command
vmstat –s shows various memory usage
statistics. The
total, used, free memory & swap details can be viewed via this command.
/proc/meminfo file
/proc/meminfo file shows various memory
usage statistics. The total, used, free memory & swap details can be viewed
via this file