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.

  • Out of curiosity, have you considered using a standard RDBMS like SQL Server? The specifications you list are not large by any means. SQL Server could handle that data very easily. – Max Vernon Aug 7 '13 at 18:42
  • Hi, the main purpose is to run on 712 MB linux server. So I'm planning everything shall be lightweight. – Nilay Parikh Aug 30 '13 at 9:31
  • Have you considered using PostgreSQL - it can handle the load with ease, and you'd benefit from a wider community of users. – Max Vernon Aug 30 '13 at 14:47
  • Benefit of having node.js and mongodb is json! PostgreSQL and any other non-JSON Object datastore may need additional processing. Not sure though? Can you share your experience with PostgreSQL I think this would be useful comparision, kylebush2009.wordpress.com/2012/03/25/mongodb-vs-postgresql – Nilay Parikh Aug 30 '13 at 18:50

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.

  • This sentence is not quite clear for me: 'If it is good or not it depends on, 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' Could you reword it? – dezso Sep 13 '13 at 11:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.