MongoDB 3.0

Sitecore on MongoDB 3.0 – what should you know

Recently, MongoDB announced their newest version – MongoDB 3.0 (3.0.1 to be very specific). What is the biggest difference compared to the earlier versions and what do you need to know to make full advantage of upgrading? Let’s dive right in.

In MongoDB 3.0 there are many innovations but in this article I just want to focus on one of them that is of great importance, if you are running your xDB on large scale – the new storage engine WiredTiger. Starting from version 3.0, MongoDB ships with the option to select between two storage engines – MMAPv1 and WiredTiger. MMAPv1 has been the storage engine that powered MongoDB since the very beginning and till now it was the only option to go with. Now you can select what storage engine you would like to use. A thing to remember – as default the original MMAPv1 engine is installed. So, why would you want to go for WiredTiger? Simply for two reasons:

  1. Performance – because of the way, how WiredTiger writes files to disk, there is a gain of performance over the MMAPv1. Multiple-level caching also helps when flushing data from memory to disk (compared to the MMAPv1 which basically relies on the underlying operating system to handle data persistence to disk.
  2. Compression – There is no compression on MMAPv1 whereas there are two levels of compression available in WiredTiger. By default the snappy compression method is active, but you can activate a more space-saving and CPU-intensive zlib compression method. Of course all compression can be also de-activated.

What changes does WiredTiger require on xDB?

Fortunately zero. The storage engine takes care of saving the content from the database and does not have impact on the way how the application communicates with the database. Therefore it is just matter of activating it. If you are running an existing xDB installation and you would like to switch to WiredTiger, there is a migration procedure to perform.

UPDATE 14.4.2015: Although xDB requires no change, due to updates in the security model of MongoDB 3.0 (regardless of WiredTiger), you might need to update the C# Mongo drivers in Sitecore. To date Sitecore 8 Update 2 contains the driver version 1.8.3.9, which is not entirely compatible with MongoDB 3.0. Thanks to the guys in the comments, especially Richard, for pointing this out.

Any automation at hand for sandbox environments?

Of course! If you are installig a Sitecore sandbox environment and want to use MongoDB 3.0 with WiredTiger, here you go with a PowerShell configuration script that will set up the MongoDB Windows service, running WiredTiger:

 

10 thoughts on “Sitecore on MongoDB 3.0 – what should you know”

  1. Hi Gianluca,

    An interesting post to read for nice work and thanks for sharing. Howerver Mongo 3.0 is yet not officially supported by Sitecore and we ran into one issue while we enabled authentication on MongoDB.

    1. Hi Brijesh,
      thanks for your comment – I am happy to read that 🙂 It is also interesting to hear about the problems with authentication you are mentioning. Could you expand a little on what was the problem you ran into?

  2. We are using v3. You will need to upgrade the Mongo client library package to v1.10 via NuGet otherwise will likely be unable to connect as v3 also introduces new authentication protocols and the default is the new one (so older client libs that do not explicitly state which to use inadvertently use the wrong one).

    We have seen no errors from this setup and have a ticket open with Sitecore regarding supporting it.

    1. Hi Richard,
      thanks for your comment! As you say, MongoDB 3.0 introduces new security models, therefore this could be a problem with the outdated drivers, that also Brijesh was pointing out. However, what do you mean by “Mongo client library package v1.10”? I am only aware of the MongoDB C# drivers that are currently of version 2.0.0, available for download (and 1.8.3.9 in Sitecore 8 Rev2)

      EDIT:
      So the enigma appears to be solved! The numbering of the C# Drivers of MongoDB is a little counterintuitive. Richard you are indeed right in saying to use the driver 1.10, as according to the documentation http://docs.mongodb.org/ecosystem/drivers/csharp/ it is a fully supported driver for MongoDB 3.0, which happens to be the case also for the 2.0 driver.

      1. Which Nuget packages need to be updated?
        I am using Sitecore 8 Update-4, which is using MongoDB.Driver.DLL and MongoDB.Driver.DLL v1.8.3.9. I believe Sitecore has used since Sitecore 7.5.
        I can see these Nuget Packages have versions 2.0.1 at the moment.

      2. There are breaking changes in the 2.0 client library that means it doesn’t work properly in our testing of Sitecore (v8.0U2/3).

        I’m not sure of the current status but we’ve seen no problems with the 1.10 client… so far.

Leave a Reply

Your email address will not be published. Required fields are marked *