abhishek
abhishek

Reputation: 31

mongodb memory release

I am new to mongodb and doing some testing with it (1 master + 1 slave). We inserted 2 million documents in couple of collections (Ubuntu, with 6G RAM, Quad core) and mongodb's memory increased from 40m to 4G (we are ok with it). Now we deleted all data and we were expecting memory (RSS) to go down back to 40m. Is it normal? Does mongodb takes time to flush mem (based on some scheduling)?

Just a fyi : performance (from frontend GUI ) was really good and improved a lot with adding indexes.

thanks

Upvotes: 1

Views: 3050

Answers (1)

itsbruce
itsbruce

Reputation: 4843

  1. MongoDB works with memory-mapped files.
  2. MongoDB does not, unprompted, shrink the size of its files when records are deleted; it simply marks the space inside the files as free, to be reused.
  3. You can force Mongo to reclaim space by rebuilding the database.

http://www.mongodb.org/display/DOCS/Excessive+Disk+Space

Upvotes: 1

Related Questions