What maps MongoDb into memory - mongodb

Does MongoDb mmap everything (i.e. all data files + all indexes) into memory on start?
If database has 100GB and machine has only 4GB RAM, MongoDb mmaps whole database into memory, is it right?

MongoDB uses memory-mapped files for all data. See the following documentation for how this works:
http://docs.mongodb.org/manual/faq/storage/#what-are-memory-mapped-files
http://www.mongodb.org/display/DOCS/Checking+Server+Memory+Usage
http://www.mongodb.org/display/DOCS/Starting+and+Stopping+Mongo#StartingandStoppingMongo-MemoryUsage
http://www.mongodb.org/display/DOCS/Caching

Related

How can I get mongo db actual size?

When I run below command in mongo shell,
db.stats()
I get below and this is wired. When I check mongoDB installation folder it only used around 2 GB disk space?
see below fsTotalSize over 80 GB
From dbStats documentation:
fsTotalSize and fsUsedSize are about the filesystem that the database is stored on. They'd be used to get an idea about how much the database could grow to.
dataSize is the size of the all the documents themselves.
storageSize is the size of the data stored on the filesystem (it can be smaller than the dataSize if using compression).
So the database takes up 6.7MB on the filesystem.
dbStats
dbStats.fsTotalSize - Total size of all disk capacity on the filesystem where MongoDB stores data.
It looks like 80 GB is the total of all disk capacity on the filesystem

Using Mongo Cache as a replacement for redis

Currently, i am writing data into redis which is reduced to mongo every 2 minutes. I am wondering if i can use Mongo Cache instead of redis here. This will save the cost of 2 dbs in production.Also,the mongodb page says :
The WiredTiger cache stores uncompressed data and provides in-memory-like performance
I want to test it but i am not able to find any documentation for playing around with WiredTiger Cache.
Note: Wiredtiger is default mongo storage engine.
You can run Mongo DB as a replacement for Redis by specifying the In Memory storage engine:
mongod --storageEngine inMemory --dbpath <path>
You can read more about it here.
I may be wrong, but I believe that you will still need to run 2 Mongo DB servers, one running in Wired Tiger for disk storage, and the other running with In Memory storage for your cache service.

MongoDB shared memory usage

I was looking at the top output on a dedicated mongo machine with 16gb of ram and I noticed that the memory consumed by the mongod process was split 7.5gb RES and 7.5gb SHR. What is 7.5gb used for in SHR memory? Does this mean that mongodb actually has only 7.5gb available for mem-mapping the data?

Mongodb32-bit limitation is for single database?

I am using mongodb-v2.0. I have gone through the 32-bit mongodb limitation of "2GB". The thing which baffling me is 2GB limitation. I will explain our scenario :-
When the database reaches 2GB. It is possible to use different database name in a single instance.If so then each database will have 2GB? Can we use different instance of mongodb listening on different port. If its possible,then can we continue in creating new database until it reaches 2GB of size?. In this way can we use multiple database of size 2GB on 32-bit mongodb on 32-bit machines?
Thanks,
sampath
The 2GB are the storage limit for the mongodb server. See in the FAQ http://www.mongodb.org/display/DOCS/FAQ#FAQ-Whatarethe32bitlimitations%3F
But maybe this is your solution: Database over 2GB in MongoDB

Is there any Settings to Enble the compression of DB size in 64-bit mongoDB?

I am using 64-bit MongoDB and I had done testing with 64-bit MongoDB. The testing details are as follows:
I gave one million files as backup to my server using mongodb as my Database Storage.
My backup data size is "22.8-GB".
The mongodb size is "1.95GB".
Are there any settings available to compress the DB-Size before configuring the backup to the server?
There is no such compression option.
You may run --repair on the database in order to shrink if (if there is something to shrink).
Otherwise apply the standard compression tools on the backup files..