26

I've read the MongoDB documentation, and it comes with a warning about 32-bit systems; particularly that they're capped at 2 GB of available RAM for Mongo.

So I was wondering if that statement meant anything in regards in running MongoDB in a low memory setting like Linode's 512mb of RAM based VPS. I doubt it matters but with a 64-bit distro for later resource adding.

Any warnings or would someone recommend a minimum of a RAM to choose in a VPS for MongoDB? I know project requirements figure into this, but I mean minimum in the sense of what'd be laughable to do without for even spinning MongoDB up.

RayTFM
  • 435
  • 4
  • 7
  • 2
    Wow, their docs say "32-bit builds are limited to around 2GB of data." And here I was thinking "data" was disk space. That would be a disaster. Nearly abandoned Mongo altogether right then and there. I'm so glad I saw this question. – Joe Aug 11 '11 at 03:56

1 Answers1

25

I use it on some small production sites which are running within my Linode 512 & it's using barely any memory, only a about 5 - 6MB. My dataset is very small for now.

MongoDB uses a mapped memory storage engine, which means it relies on the OS system cache to keep frequently used data in memory.

http://www.mongodb.org/display/DOCS/Caching

So unless you have a huge dataset to start out with, a Linode 512 should be OK.

The one thing I am a little concerned with when researching this is that MongoDB seems to crash when it runs out of memory, without much warning. It's also hard to pin down exactly how much memory or disk space it's going to use proportional to how much data you have. There also is no way to specify hard limits, at the cost of degraded performance. It's something you'll probably want to monitor.

You might try running MongoDB with the --smallfiles --noprealloc options, as this allows for smaller database files to start with and not preallocate them, saving disk space if you have a small dataset.

Here is one user's experience:

http://groups.google.com/group/mongodb-user/browse_thread/thread/223810a749f0e1eb

Unfortunately that thread was not resolved, would have been nice if they had a reason for the crash.

This also is good to read:

http://groups.google.com/group/mongodb-user/browse_thread/thread/2646a52c4f41d832/d43f3ba7bbbbd63d

Klinky
  • 2,084
  • 15
  • 12
  • Ok, thank you Klinky :) I'll read those links and make sure I get a thorough understanding of the terms involved. – RayTFM Aug 24 '10 at 21:43
  • 1
    The crash is likely to be caused by the system OOM killer. Have a look at http://www.mongodb.org/display/DOCS/The+Linux+Out+of+Memory+OOM+Killer – thoaionline Dec 06 '11 at 15:26
  • It might be a good idea to create a swap file, Linode runs on SSD so it's not that terribly slow. It's always better to have a little lag under high load than to crash MongoDB completely. And make sure to adjust `vm.swappiness` so you won't hit SSD unless absolutely necessary. – Sebastian Nowak Mar 30 '16 at 13:13