Product

Weekly product update: Upgrading to MongoDB 2.4.1

This week we focused on backend improvements to make Mailgun more performant, reliable and scalable. Read more...

PUBLISHED ON

PUBLISHED ON

Originally posted on April 12, 2013.

This week we focused on backend improvements to make Mailgun more performant, reliable and scalable. Lots of boring stuff, but hopefully you’ll feel the difference.

One of the things that we did in particular was upgrade from MongoDB version 2.2 to 2.4.1. We’re big fans of MongoDB here at Mailgun. The bigger “Why MongoDB” post is long overdue but in the meantime, here’s a little color around the experience upgrading to the latest MongoDB version. We also upgraded to the latest version of pymongo: the MongoDB Python driver.

Upgrading to MongoDB 2.4.1 from 2.2

We highly recommend this version bump to anyone who’s using MongoDB in production. While you can see the complete list of what’s new in 2.4.1 on 10Gen web site, below is the list of features and improvements that we found particularly beneficial during evaluation on our staging environment:

  • New MongoClient and MongoReplicaSet classes. They introduce the new safe default: waiting for write acknowledgements.

  • Bug fixes that have happened after the introduction of 2.4.

Our infrastructure engineers performed the upgrade on a live high-stress system without any issues.

Upgrading PyMongo version

Well, by default the tests won’t pass.  You’ll have to fix some import errors. For example, objectidmodule has moved from pymongo to bson package. Otherwise the upgrade is pretty safe because the new default behavior is only present in the new connection classes.

There is one serious caveat to be aware of: in this version 10Gen introduced the idea of Requests. The connection objects you get from pymongo are now bound to their calling thread by default. Our testing showed a performance degradation by a factor on 3! Your mileage may very, but either way, it’s a very serious change of default behavior, we wish 10Gen was more explicit about this.

Upgrading the servers

You should not be using MongoDB without replica sets. This gives you the ability to not only be resilient to hardware failures, but it also makes it possible to perform database version upgrades on the fly. These are the steps we follow:

  • Obviously, make sure you have fresh backup of your data. We make backups by shutting down one of the slaves, compacting it’s database and sending the tar ball of the DB directory to Rackspace Cloud Files.

  • Upgrade one slave at a time, while monitoring the status of a replica set.

  • Finally, step down the master.

  • Upgrade the master.

All in all, very boring and uneventful procedure. Just like we like it when it comes to databases.

Till next week.

Happy Emailing, The Mailgunners

Let's talk email

Learn about our deliverability services

See what you can accomplish with the world's best email delivery platform and experts at your disposal.

Related readings

Here’s how to track email opens in Gmail with email tracking

Sending email campaigns doesn’t have to feel like you’re throwing darts into a black hole. Email analytics are a great way to determine the health of your ecommerce campaign and...

Read more

Everything you need to know about sending email with APIs

Are you creating an e-commerce web page that needs to send transactional emails to customers? A developer building a web application that needs to send messages to email...

Read more

A practical guide to using Mailgun’s webhooks

Transactional emails are essential for most apps. We send welcome emails, password...

Read more

Popular posts

Email inbox.

Build Laravel 10 email authentication with Mailgun and Digital Ocean

When it was first released, Laravel version 5.7 added a new capability to verify user’s emails. If you’ve ever run php artisan make:auth within a Laravel app you’ll know the...

Read more

Mailgun statistics.

Sending email using the Mailgun PHP API

It’s been a while since the Mailgun PHP SDK came around, and we’ve seen lots of changes: new functionalities, new integrations built on top, new API endpoints…yet the core of PHP...

Read more

Statistics on deliverability.

Here’s everything you need to know about DNS blocklists

The word “blocklist” can almost seem like something out of a movie – a little dramatic, silly, and a little unreal. Unfortunately, in the real world, blocklists are definitely something you...

Read more

See what you can accomplish with the world's best email delivery platform. It's easy to get started.Let's get sending
CTA icon