Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can MongoDB work when size of database larger then RAM?

Tags:

mongodb

or when index larger then RAM?

like image 205
SomeUser Avatar asked Mar 08 '11 14:03

SomeUser


People also ask

Does MongoDB need a lot space of RAM?

MongoDB requires approximately 1 GB of RAM per 100.000 assets. If the system has to start swapping memory to disk, this will have a severely negative impact on performance and should be avoided.

What is the maximum size of MongoDB database?

Hi Federica, The maximum size an individual document can be in MongoDB is 16MB with a nested depth of 100 levels. Edit: There is no max size for an individual MongoDB database.

Does MongoDB use RAM?

MongoDB will allocate per default 50 % of (RAM - 1GB), so we have in this example 63,5 GB RAM for MongoDB. 63,5 GB minus 23,5 GB for the indexes will make 40 GB remaining for documents. from the mongod.

Is MongoDB a memory or disk?

MongoDB does store all its data on disk so that it can persist it during server restarts. However, it is primarily liking memory. It relies on the Operating System to schedule which bits of its database stay in memory, and which stays on disk.


2 Answers

Yes it can work. To what level it will perform is more of an "It Depends"

The key thing is to ensure your working set can fit in RAM. So if you have 16GB of RAM and 20GB database (inc. indexes) for example, if you need to only access half of all the data as the other half is older/never actually queried then you'll be fine as only half of your database needs to be in RAM (10GB).

Working set is key here. For example, if you have a logging application outputting to MongoDB, it may be that your working set is the amount of data (and indexes) from the past 3 months and that all data before that you don't access.

When your working set exceeds the amount of RAM, then it will carry on working but with noticeably degraded performance as things will then be constantly having to go to disk which is far less performant. If you're in this situation of exceeding RAM constraints on a machine, then this is where sharding comes into play - so you can balance the data out over a number of machines therefore increasing the amount of data that can be kept in RAM.

like image 155
AdaTheDev Avatar answered Sep 30 '22 14:09

AdaTheDev


Nicely explained here: http://blog.boxedice.com/2010/12/13/mongodb-monitoring-keep-in-it-ram/

like image 43
techpaisa Avatar answered Sep 28 '22 14:09

techpaisa