jianpx
jianpx

Reputation: 3330

why mongodb on 32-bit machine has limitation of datasize to 2GB , not 4GB?

as here mention, mongodb has limitation of datasize to 2GB in 32-bit machine with one single mongod instance. But I wonder 32-bit machine has 4GB addressable space in theory, and mongod can use this 4GB instead of 2GB for virtual memory usage. So why the answer is 2GB, not 4GB?

Upvotes: 4

Views: 3478

Answers (2)

Stennie
Stennie

Reputation: 65403

4Gb of addressable space is not the same as the memory space available for memory-mapped files opened by user applications. Some of the addressable space is reserved for the O/S kernel and memory-mapped devices such as video cards.

For example, 32-bit Windows limits user mode (and thus memory-mapped files) to ~2Gb RAM and total system RAM to ~3.5Gb.

For more reading, see:

The majority of modern desktop and server environments starting moving to 64-bit almost a decade ago (see 64-bit operating system timeline on Wikipedia) so this isn't a limit that practically affects deployment.

You would only want to use 32-bit MongoDB in a development environment with limited data.

Upvotes: 8

Matt Ball
Matt Ball

Reputation: 360016

32-bit MongoDB processes are limited to about 2 gb of data. This has come as a surprise to a lot of people who are used to not having to worry about that. The reason for this is that the MongoDB storage engine uses memory-mapped files for performance.

By not supporting more than 2gb on 32-bit, we’ve been able to keep our code much simpler and cleaner. This greatly reduces the number of bugs, and reduces the time that we need to release a 1.0 product.

http://blog.mongodb.org/post/137788967/32-bit-limitations

Upvotes: 2

Related Questions