If you are running Sitecore 8 Update 5 or less then you are likely running MongoDB 2.6 as the compatibility table states this is the only supported version since Sitecore XP 7.5.

However there are issues with MongoDB 2.6 and Sitecore XP 7.5 and 8.0 that can lead to performance problems

 

Using this version of the Mongo C# driver may cause excessive connections being open to the xDB database, as well as performance degradation.

 

MongoDB 2.6 is scheduled for End Of Life after October, 2016 (https://www.mongodb.com/blog/post/mongodb-2-6-end-of-life). This would leave no supported MongoDB versions that are compatible with Sitecore 7.5 and early versions of Sitecore 8.0.

You can read in full here.

We were seeing issues with MongoDB under load, requests were backing up in the application and causing high CPU usage.

Just as there are benefits from updating the MongoDB.Driver version there are also performance benefits from upgrading to MongoDB 3.2

mongodb-30-1038x576

So if you are on Sitecore 8.0 Update 4 or less and are not ready to upgrade to a higher version of Sitecore XP you can update the driver manually and use a new version of MongoDB.

 

Upgrading the MongoDB Driver

 

  1. Update the Official .NET driver for MongoDB to at least 1.10 using NuGet
    Install-Package mongocsharpdriver -Version 1.10.0
  2. Add bindingRedirects for the MongoDB Driver dlls
    <configuration>
     <runtime>
     <assemblyBinding>
     ...
    <dependentAssembly>
     <assemblyIdentity name="MongoDB.Bson" publicKeyToken="f686731cfb9cc103" culture="Neutral" />&nbsp;
     <bindingRedirect oldVersion="1.8.3.9" newVersion="1.10.0.62" />&nbsp;
     </dependentAssembly>
     <dependentAssembly>
     <assemblyIdentity name="MongoDB.Driver" publicKeyToken="f686731cfb9cc103" culture="Neutral" />&nbsp;
     <bindingRedirect oldVersion="1.8.3.9" newVersion="1.10.0.62" />&nbsp;
     </dependentAssembly>
      ...
     </assemblyBinding>
     </runtime>
    </configuration>
    

Upgrade MongoDB Database and Data

  1. Install a new version of MongoDB from here
  2. Open a Administrator CMD prompt
  3. Navigate to the 2.6 MongoDB install bin directory
     cd C:\Program Files\MongoDB 2.6 Standard\bin 
  4. Export all the 2.6 MongoDB data to disk so we can import it to the new WiredTiger storage engine
     mongodump --out "C:\MongoDB\export"
  5. Stop your MongoDB 2.6 service
  6. Create the new folder structure for the WiredTired storage engine eg C:\MongoDb\dataWT\db  and C:\MongoDb\dataWT\log Note  :- mongod with WiredTiger will not start with data files created with a different storage engine.
  7. Update your MongoDB config, mongod.cfg, file with the new properties for version 3.2, here is a config file I used.
  8. Start the new MongoDB 3.2 service.
  9. Open a Administrator CMD prompt
  10. Navigate to the new MongoDB install bin directory
    cd C:\Program Files\MongoDB\Server\3.2\bin
  11. Run
    mongorestore "C:\MongoDB\export" 

    to import the old 2.6 Mongo DB data to the new WiredTiger format.

When I ran through the process of upgrading a production instance the size of the MongoDB data folder was reduced from 4.5GB to 560MB, we also noticed improved performance of mongoDB  meaning threads were no longer backing up on the web server.

References

 

Leave a Reply

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