MongoDB Not Using All Available RAM

560 views
Skip to first unread message

Chris Wilcox

unread,
Dec 13, 2012, 6:29:29 PM12/13/12
to mongod...@googlegroups.com
I have something around 200 GB worth data stored in a mongo cluster. The physical memory on one of the instances which runs mongo is 8GB. Nothing else of any consequence runs on this instance. As near as I can understand based on Mongo's docs (like this one: http://www.mongodb.org/display/DOCS/Checking+Server+Memory+Usage) this means that the mongod process should be using about 100% of the available physical memory. But if you look at the following output from the "top" command you'll see that the mongod instance is only using 2GB of resident memory and theres a full 2GB of free physical memory available which isn't being used at all.

Can someone explain this behavior to me? Why is there 2GB of free memory?

Top output:

top - 23:19:43 up 89 days, 20:05,  2 users,  load average: 0.41, 0.55, 0.59
Tasks: 101 total,   1 running, 100 sleeping,   0 stopped,   0 zombie
Cpu(s):  2.0%us,  1.3%sy,  0.0%ni, 93.9%id,  2.6%wa,  0.0%hi,  0.1%si,  0.0%st
Mem:   8163664k total,  6131764k used,  2031900k free,    54976k buffers
Swap: 16771848k total,    10604k used, 16761244k free,  5367700k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                             
 1401 mongodb   20   0  174g 2.0g 1.9g S   23 26.2  18070:55 mongod
…...

Chris Wilcox

unread,
Dec 13, 2012, 6:31:54 PM12/13/12
to mongod...@googlegroups.com
Some additional information:

1) There is another instance in this cluster where mongod is behaving as I would expect and utilizing all available memory.

2) Looking at mongostat it looks like were consistently having some page-faulting, so the amount of memory used *should be* growing:

Example "mongostat" output:

insert  query update delete getmore command flushes mapped  vsize    res faults    locked db idx miss %     qr|qw   ar|aw  netIn netOut  conn set repl       time 
     0     23     18      0      31       3       0  86.4g   174g   2.1g      8  nimbus:1.7%          0       0|0     0|0     9k    11k   226 rs2  PRI   23:29:48 
     0     13     13      0      25      14       0  86.4g   174g   2.1g      8  nimbus:2.5%          0       0|0     0|0     7k    28k   226 rs2  PRI   23:29:49 
     0      6     11      0      20       9       0  86.4g   174g   2.1g      1  nimbus:0.4%          0       0|0     0|0     5k     9k   226 rs2  PRI   23:29:50 
     0      4      6      0      10       4       0  86.4g   174g   2.1g      2  nimbus:0.3%          0       0|0     0|0     2k     5k   226 rs2  PRI   23:29:51 
     0     11     11      0      20      12       0  86.4g   174g   2.1g      3  nimbus:0.5%          0       0|0     0|0     6k    17k   226 rs2  PRI   23:29:52 

Thanks!

Adam C

unread,
Dec 18, 2012, 9:35:15 PM12/18/12
to mongod...@googlegroups.com
Hi Chris,

I answered this here, mainly because I saw the question there first and only saw your note about it being a mongodb-user question later: 


Let me know if that doesn't answer your questions - it can be easy to troubleshoot in the group than on Stack Exchange comments.

Adam
Reply all
Reply to author
Forward
0 new messages