1

Possible Duplicate:
Meaning of the buffers/cache line in the output of free

I have two servers, server1 and server2. Both of them are identical HP blades, running the exact same OS (RHEL 5.5). Here's the output of free for both of them:

### server1:
             total       used       free     shared    buffers     cached
Mem:       8017848    2746596    5271252          0     212772    1768800
-/+ buffers/cache:     765024    7252824
Swap:     14188536          0   14188536

### server2:     
             total       used       free     shared    buffers     cached
Mem:       8017848    4494836    3523012          0     212724    3136568
-/+ buffers/cache:    1145544    6872304
Swap:     14188536          0   14188536

If I understand correctly, server2 is using significantly more memory for disk I/O caching, which still counts as memory used.

But both are running the same OS and if I remember correctly, I configured both with the same parameters when they were installed. I did a diff on /etc/sysctl.conf and they are identical.

The problem is, I am collecting memory usage and other metrics over a period of time, (eg: vmstat, iostat, etc.) while a load is generated on the system. The memory used for caching is throwing off my calculations on the results.

How can I measure actual memory usage from my running processes, rather than memory usage by the OS for caching? Is used - (buffers + cached) a valid way to measure this?

NullUser
  • 143
  • 1
  • 2
  • 11

2 Answers2

2

This really isn't a problem... Are you trying to solve something?

The other suggestion about freeing your page cache, inodes and dentries via the VM subsystem's drop_caches parameter is appropriate. Try that first.

See: http://www.linuxinsight.com/proc_sys_vm_drop_caches.html for background and context.

If you're really curious as to what's consuming your RAM or disk cache, you can look at the vmtouch utility or look at top and sort by memory usage (type "M"). Running pmap -x against the resulting topmost PID's may give you an idea of what's in the virtual memory (caching) system.

ewwhite
  • 194,921
  • 91
  • 434
  • 799
  • I'm trying to measure roughly how much memory is being used by a set of processes (an Oracle Database instance). Since it's the only thing running, I'm making the leap that most of the memory used by the system is being used by Oracle. – NullUser Oct 29 '12 at 22:47
  • It's easy to see this in `top`. Did you try that? – ewwhite Oct 29 '12 at 22:51
  • I am collecting memory usage and other metrics over a period of time, (eg: `vmstat`, `iostat`, etc.) while a load is generated on the system. The memory used for caching is throwing off my calculations on the results. – NullUser Oct 29 '12 at 22:54
1

Can you clear cache by using

sync; echo 3 > /proc/sys/vm/drop_caches

and then test it using

free -t -m
Hex
  • 1,939
  • 10
  • 17