How To Test Your MongoDB Application Upgrades?

You have chosen MongoDB as your application database, and probably have a lot of production data in your database already. Now, you need to make a major change to your application. How do you go about testing to make sure the new version of your application behaves well with your production data?

Production data is always infinitely more varied than your test data and exercises more edge cases, consequently leading to more bugs. It’s not recommended to export production data into your test environment due to policy, privacy and security issues. On the other hand, it’s fairly difficult and expensive to identify and test bugs in production. So, how do you go about ensuring that the new version of your application works well with production data?  Here is what we recommend at ScaleGrid:

4 Steps in Upgrading MongoDB to Production

  1. Safety First

    Our first concern is the safety and security of the production data. So, we never export any production data to our staging or test environment. What we have is “pseudo-production” – this is an environment that’s identical to production – same size, same security restrictions as production. However, it’s ephemeral and only lives for the duration of the test.

  2. Clone Your Production MongoDB Cluster

    MongoDB on AWS

    We use the ‘Clone’ feature of ScaleGrid to create a point-in-time clone of the production database. On clouds like AWS, the Clone feature uses EBS snapshots, so the clone operation has little to no impact on the production database. This gives us a “pseudo-production” database environment that has all the same features as production – same data, same machine sizes, same security, same cluster configuration, etc.

  3. Run Extensive Tests

    We run an extensive set of tests to ensure that the new version of the application does not cause problems with the data. Once we’re satisfied, we tear down the “pseudo-production” environment.

  4. Upgrade Your Production Environment

    Once we’re satisfied with our testing, we go ahead and upgrade our application in production. Depending on the feature, you might also want to upgrade it only for some of your customers,  a.k.a, A/B testing.

So, what other problems do you have with testing application upgrades with MongoDB? Do you have tools, techniques or suggestions that you would like to share? We’d love to hear from you!


Dharshan is the founder of ScaleGrid.io (formerly MongoDirector.com). He is an experienced MongoDB developer and administrator. He can be reached for further comment at @dharshanrg


0 Shares
+1
Tweet
Share
Share
Pin