I have just compiled MongoDB in my linuxOS and not insert any data into DB.

The virtual memory is getting very large, about 40G.

ps aux|grep mongod

mongodb 176574 0.0 0.0 423784 39008 pts/308 Sl 09:00 0:00 mongod

Why does the virtual memory so huge, I haven't insert any data in it?

  • 423784kB/1024/1024 = 0.40GB – edze Feb 7 '14 at 10:46

MongoDB uses memory mapped files for performance I'll point you to a longer answer from me on this here but in essence large amounts of virtual memory usage are not something to worry about. In the case of virtual memory you'll see double usage with journaling, however this is less drastic then it sounds as the space is not actually used until there is an update. It is marked to the OS as being used despite being potentially empty when you start.

These aspects are all elements of how MongoDB uses the memory subsystem to provide performance, similarly to how it preallocates disk space to ensure these resources are marked and ready to serve your connections when they occur.

There's an interest presentation on MongoDB's storage layer that explains how the storage is managed and allocated, aggressively in most cases which tends to bump up these numbers.

|improve this answer|||||

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.