Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

marked as duplicate by Zoredache, Magellan, EEAA, John Gardeniers, Lucas Kauffman Oct 30 '12 at 10:38

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
This is because server2 has cached more things in memory compared to server1 –  Hex Oct 29 '12 at 21:58
    
@MichaelHampton I did a top and that doesn't seem to be the case. –  NullUser Oct 29 '12 at 22:00
    
@Hex Is used - cached or used - (cached + buffers) a valid way to measure actual memory used by running processes? –  NullUser Oct 29 '12 at 22:01
    
Sorry, but what is the problem? –  Zoredache Oct 29 '12 at 23:03
    
@Zoredache Sorry, XY problem. I updated my question. –  NullUser Oct 29 '12 at 23:03

2 Answers 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.

share|improve this answer
    
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

Can you clear cache by using

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

and then test it using

free -t -m
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.