Memory management scenario with MongoDB I'm implementing a medium scale marketing e-commerce affiliation site, which has following estimates,

Total Size of Data: 5 - 10 GB
Indexes on Data: 1 GB approx (which I wanted to be in memory)
Disk Size (fast I/O): 20-25 GB
Memory: 2 GB
App development: node.js

Working set estimation of Query: Average 1-2 KB, Maximum 20-30 KB of text base article


I'm trying to understand whether MongoDB would be right choice for database or not. Index is going to be fairly downsize of Memory but I have noticed that after querying that MongoDB, it has occupied the memory (size of result set) for caching query. In 8 hours I'm expecting that all queries' depth would cover almost 95% of data, in that scenario how will MongoDB manage limited memory scenario also app instance of node.js running on same server.

Would a MongoDB a right choice for this scenario or I should go for other JSON based no-SQL Databases.
Mongodb uses mmap for memory management, relies 100% on the OS memory management. This means whatever memory you have left it has a really high possibility will be eaten up by mongo cause the entire datafile structure is mapped to virtual address space (It is not certainly a problem while the paging between physical and virtual memory is not that dumb to break your system down). 

While Linux will page out some parts of the physical memory, so not the whole virtual segment have to be in physical memory just the recently accessed parts (check this), depend on the usage pattern mongo can run without problem.  If the OS will have to extensively page things mongodb will be slow.  You can restrict the usage of the memory. I would recommend to use cgroups. For your probable workload memory usage you can check also this documentation to have some idea.