As of version 3.0, MongoDB now supports several different storage engines. One of the engines available is an experimental “In Memory” engine.
MongoDB automatically loads frequently-accessed data into memory using the default memory-mapped files storage engine (MMAP V1). If you are working with a relatively small amount of data, this on-disk storage engine will likely have your data loaded in memory anyway as part of your active working set.
As an aside, here’s a quick comparison of the two on-disk storage engines available in MongoDB 3.0.
More details are available here.
But developers have still been trying to find ways to force MongoDB into using purely in-memory storage for some time.
On the Windows platform, here’s how to play with the new, experimental in-memory storage engine being officially developed by the MongoDB folks.
1. Create a folder to hold log, lock, and pid files
MongoDB still wants a location on disk for certain artifacts, even with an exclusively in-memory DB. So create a folder for that like so:
2. MongoDB In-Memory Windows Service
Now, from the MongoDB “bin” folder, tell MongoDB to install an instance of itself as a Windows Service that will listen on port 27018 (just an example, the default is 27017) and use the experimental in-memory storage engine:
C:\Program Files\MongoDB\Server\3.0\bin>mongod --install --serviceName MongoDBInMem --serviceDisplayName MongoDBInMem --port 27018 --dbpath c:\data\mem --logpath c:\data\mem\log --pidfilepath c:\data\mem\memdb.pid --storageEngine inMemoryExperiment
3. Start it Up
Now start the service like so:
C:\Program Files\MongoDB\Server\3.0\bin>net start MongoDBInMem
Original article @ mongodb in memory storage engine setup
For all your application development needs, visit www.verbat.com for a fiscally conscious proposal that meets your needs ( So I can keep this blog going as well!!!!)
Alternatively click through the link if you found this article interesting. (This will help the companies Search engine rankings)