views:

81

answers:

3

This post says that you need a 64 bit system for MongoDB if your data is bigger than 2GB.

In my local machine, a 64 bit Intel C2D running 32 bit Mac OS X Leopard, the MongoDB 64 bit version runs without any error.

On the server, a 64 bit machine running 32 bit CentOS 5.0, the 64 bit MongoDB won't run. 32 bit runs OK.

My question is, does MongoDB requires both Hardware AND the OS Kernel to be 64 bit? If so, why the discrepancy in my experience in the above systems?

+2  A: 

If your data is > 2GB, the kernel needs to be able to address > 2GB memory. This requires either a 64-bit kernel, or you could try using the PAE kernel extension to allow a 32-bit kernel to address more RAM.

Perhaps MAC OS X already has something like the PAE extension, hence the discrepancy.

Peter
+1  A: 

Actually the requirement is that if you want to work with more than about 2GB of data you need to use a 64-bit version of the mongod executable. This requires a 64-bit OS which in turn requires 64-bit hardware.

The requirement has nothing to do with physical ram and is about how much virtual memory a single process can address. Since mongodb uses mmap to map the contents of data files, you must have at least enough virtual address space to fit all of your data. Note that virtual address space is not increased by PAE. PAE is purely a Physical Address Extension to allow you to have more than about 3.5GB of RAM.

Edit: It looks like it is possible for a kernel running in 32bit mode to be written in a way to support 64bit userspace. OSX running on 64bit hardware is the only example I know of that uses this though. On windows and linux you must install the 64bit version of the operating system to run 64bit software.

mstearn
So is OS X a special case as @MGriesbach has metioned? can it run 64 bit application in 32 bit mode?
rubayeet
I'm pretty sure it just uses a 64bit kernel when on 64 bit hardware (any mac newer than first-gen Intel). You still need to use the 64-bit binaries.
mstearn
"uname -m" on OS X gives "i386" output in the terminal. Still it's able to run the x86_64 version of MongoDB. But the CentOS is only able to run the 32 bit version.
rubayeet
Interesting. Looks like OSX does some trickery. I'll update my answer.
mstearn
A: 

MAC OS X is a special case, since it tries VERY hard to hide the whole 32/64 bit stuff from the user. Leopard, afaik, already supports 64 bit apps through some tricks.

MGriesbach
Sounds strange. Is there any such other 64 bit application that runs on 32 bit OS X kernel?
rubayeet