Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What are the RAM requirements like between MongoDB and MySQL for the same data set and usage? (i.e. under the exact same scenario, how much RAM will each use)?

It is true that MongoDB keeps the full database in RAM?

share|improve this question
up vote 2 down vote accepted

mongo will attempt to always keep the whole database in RAM.. but as the OS needs RAM for other apps it will release parts that mongo uses.

The thing mongo needs to keep in RAM is the indexes to stay fast.

In my application mongo uses a lot less RAM then mysql but it really depends on how many indexes you have and the size of your data set.

share|improve this answer

A major issue with Mongo for large datasets is that Mongo uses memory mapped files. There is no way to limit the amount of ram Mongo will try to use on a machine. So it basically expects the entire resources of a machine, a dedicated box. This is only an issue if your data is large and especially when your indexes are bigger than ram. To answer your question about data, MongodDB will really only try to keep the indexes in RAM.

share|improve this answer

We have small cluster (2 shards), and the main points we have got:

1) MongoDB store indexes in RAM and as much data as possible (as answered above) yes, it's true The best way is store ALL data in ram. (our project has about 1 million unique users/day and about 30 million requests => storing all data in ram so important for us).

2) If your ram size is over - its time to divide your mongo server (fortunately, in MongoDB it's very easy to configure)

The main storage we use, is about 40gb data and 10gb indexes. Works on two shards 32GB ram each.

share|improve this answer

Your Answer


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.