Recently MongoDB 3.2 was released. Not too long ago I have written about the MongoDB 3.0 and its fantastic new WiredTiteger storage engine. So is it worth to upgrade to 3.2? Well… Absolutely!
MongoDB 3.2 introduces a series of new very interesting features, among which new storage engine options or rather storage engines, operation and administration options and new data analysis tools. Let us however have a look at the first two options now.
First and foremost, all of the new storage engine options are available only for the Enterprise edition of the MongoDB. However, if you would like to try any of it out, go ahead and grab your copy at no cost or duty right here: https://www.mongodb.com/download-center#enterprise. In fact, for evaluation and testing the Enterprise edition is for free.
In-Memory storage engine
The In-Memory storage engine runs completely in memory. That means, that all data saved in the database are not persisted on disk, they are only kept in memory. As you might have already guessed, this is not the best option if you want to keep your xDB contact data safe for longer than the uptime of your server. However, if you ever ran a Sitecore solution that experienced high loads, you might know that session serialization to SQL server is painfully slow. Not only you can run your private (regular .NET) sessions in Sitecore with MongoDB, but now also completely in memory. This gives you fantastic performance on these volatile data for the distribution among multiple servers in your delivery cluster.
If you cannot live without ensuring your sessions will not be lost when an outage of the database occurs, you can replicate your database to a slower tier, using nothing else than the standard MongoDB replication, which will ensure disk persistence. That means, you will have your primary for fast reads/writes completely in memory and one or more secondaries of data persistence. If you happen to have a downtime on the fast machine, automatic failover will ensure smooth transition for your website users and no carts will be lost. That is fantabulous!
If you wonder, how to run this on a single machine for test with your good ol’ MongoDB for your xDB, you could do as follows.
In the command line start with your standard MongoDB for xDB data, where you specify a Service Name and Service Display Name, so that you can then recognize what service is doing what:
mongod --dbpath C:\MongoData\Data\xDB --logpath C:\MongoData\Logs\xDB\mongo.log --install --serviceName MongoDBxDB --serviceDisplayName "MongoDB xDB"
net start MongoDBxDB
Then you can proceed with setting up the MongoDB repository for your sessions:
mongod --dbpath C:\MongoData\Data\Sessions --logpath C:\MongoData\Logs\Sessions\mongo.log --port 27018 --install --serviceName MongoDBSessions --serviceDisplayName "MongoDB SESSIONS" --storageEngine inMemory
net start MongoDBSessions
You can see, that you need to specify a data folder also for the In-Memory engine. This is because the In-Memomory engine needs to store metadata there.
The final step is to configure Sitecore to be able to store sessions in MongoDB. And here you go – blazing fast session store for Sitecore – DONE!
One last comment to add though – the In-Memory engine is in a beta so far, so no productive use is recommended as of yet.
Encrypted storage engine
If you, like me, encounter on a daily basis questions and concerns about user data privacy and the fear of giving out company’s data to a public cloud, MongoDB 3.2 brings just the solution for you – Encryption of data at rest with the new option for the WiredTiger storage engine. You can hook in your keys using a key manager that supports the KMIP (Key Management Interoperability Protocol) or have a locally managed key, which is ok for testing, but usually not for productive running.
Encryption of data at rest takes its toll on performance, detracting a few percent of the normal operation performance, compared to a “standard” WiredTiger deployment, however, (according to MongoDB at least) the performance should be comparable to or better than other encryption mechanisms for data at rest. Personally, I have not had the chance to test this so far, so I cannot comment on it.
Encryption of data at rest and enabling TLS/SSL for communication over the wire offers very good protection against misuse of customer data by any unintended third party.
The second thing that I found really interesting is the MongoDB Compass application that you can download from here: https://www.mongodb.com/download-center#compass Many people, who work with MongoDB, use Robomongo or MongoVue as the GUI for the database, opposed to working just in the command line shell. The guys at MongoDB decided to provide finally a tool of their own to be able to visualize the content of the database and perform operations to it even without writing any commands at all.
This is great especially in the cases, where you have operations divisions that have to run this new “Mongo” thing and they have absolutely no experience with it. It definitely is not a full replacement of a skilled DBA, but to quickly dive into the structure of your database and understand its principals, it is great.
Go ahead and explore MongoDB 3.2 with Sitecore 8.1 – my new combination of choice 🙂