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

In mongodb i work with this collection:

Size     55.93g 
Data Size    39.82g
Storage Size 41.08g 
Extents  53 
Indexes  4 
Index Size   9.64g

It takes few seconds of mongdb being up with this single collection and all 48GB RAM on the dedicated server are gone.

That's worse because there is also a mysqld+nginx/fcgi on this machine which should be allowed to use at least 24GB together. I.e. remaining 24GB, enough for the mongod!

However, it does not share in a fair way. Everybody says that the memory for mongod is managed by OS and releases unneccessary space for other processes if they demand RAM. On my machine it is not releasing RAM. What's wrong?

free

             total       used       free     shared    buffers     cached`
Mem:      49559136   49403908     155228          0      57284   47247564
-/+ buffers/cache:    2099060   47460076
Swap:      8008392        164    8008228
share|improve this question
    
Could you append the output of the "free" command? –  Christopher Perrin Jun 22 '12 at 13:36
    
done in the top posting –  ledy Jun 22 '12 at 13:45
1  
's/linux/mongodb' -- linuxatemyram.com –  Aaron Copley Jun 22 '12 at 14:16
    
Sounds like normal MongoDB performance to me. –  Tom O'Connor Jun 22 '12 at 14:55

1 Answer 1

up vote 7 down vote accepted

As you see in your output of free, 47460076 byte are cached. They are freed if needed. Don't worry you have plenty of memory and mongoDB won't eat it. It just takes a bit of ram that is immediately freed when other applications really need it.

share|improve this answer
    
how to define the number of MB to be reserved as "backup" ram? mongod seems to take care of at least 100-300M (or doesn't want them...) In case of emergency it takes some time to release the ram and i had the oom-killer doing the job which is not the proper way! –  ledy Jun 26 '12 at 6:22
    
What would be an emergency? You might read through this page posted above: linuxatemyram.com –  Christopher Perrin Jun 26 '12 at 20:32
    
Mongo should be on a dedicated box/VM. I tried running it with apache/mysql with horrible results whenever I had a spike on apache, because mongod had claimed too much RAM and apache was tuned to use more than was available (which was almost nothing) without a lot of page faults. My advice: keep mongodb away from other programs, you'll thank me later. –  Wes Freeman Jun 28 '12 at 19:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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