0

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?

Mark Henderson
  • 68,823
  • 31
  • 180
  • 259
Boris
  • 151
  • 1
  • 7

3 Answers3

3

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.

Amala
  • 529
  • 2
  • 14
2

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.

Mike
  • 22,310
  • 7
  • 56
  • 79
1

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.

Vitaly Baev
  • 131
  • 5