How memory usage is represented in the unix free command

23 views
Skip to first unread message

Tim Haines

unread,
Nov 16, 2012, 2:15:07 PM11/16/12
to mongod...@googlegroups.com
Hi there,

I have one server with 8GB of RAM with 2 dbs, each holding a collection.  Stats shows one collection has a 2G storage size and a total index size of 2G.  The other collection has a storage size of 1G, and a total index size of 0.5G.  So, a total of 5.5G of data + index.

When I run free -m I see:

             total       used       free     shared    buffers     cached
Mem:          7958       6459       1499          0        167       5659
-/+ buffers/cache:        631       7327
Swap:          975          0        975


I'm surprised by 2 things.  1) That the cache is larger than the memory reported as being used.  and 2) that there's 7.3G of cache reported as being free, and only 631M reported as being used, when I have 5.5G of data+ index.

How does the memory being used by Mongo get represented in the free output?  Is it a mixture of the free and used cache?

Cheers,

Tim.

David Hows

unread,
Nov 30, 2012, 1:26:38 AM11/30/12
to mongod...@googlegroups.com
Hi Tim,

This is to do with the way that Linux keeps track of RAM.

Its likely that the pages in RAM in which those datafiles reside in have not been touched in a while and as such they have been added to the list of free pages.

Cheers,

David
Reply all
Reply to author
Forward
0 new messages