Reap the benefits of upgraded MongoDB instances
Upgrading from an older version of MongoDB can be painful. We get it. Your app is working, you don’t have the time or resources to upgrade even though you know you need to. It stays at the bottom of your backlog because new features and enhancement to your application are always more critical to the business. You keep putting it off, knowing that you are getting farther and farther behind.
We talk to many IT and DevOps leaders that find themselves in this situation. They use MongoDB 2.4 or 2.6 and they’ve fallen really far behind. And they feel stuck.
MongoDB Inc. releases updates about once a year. In February, MongoDB deprecated version 3.0. MongoDB has also announced that they are deprecating version 3.2 in September. Each release brings new features, major bug fixes, and performance enhancements. When evaluating an upgrade to a newer version, you may have some features you’d like to add and there may be some nagging bugs you’d like to squash. We have upgraded thousands of instances over the years and we’ve learned a lot.
Here are some reasons it can be painful to upgrade your MongoDB instances:
Both minor and major version upgrades can usually be completed without any downtime, if your driver is set up to be resilient during a step down and mongos restart. Timelines for upgrades depend on many factors, such as which version you’re currently running, your applications’ needs, and which features will offer the most benefit for your app. Most customers can expect a 30-minute maintenance window with a 15 second period of downtime. Contact support for an estimate based on your set up.
Rewriting Code & Deprecated Features
It’s not uncommon to have to change your code in order to upgrade. Each new major version may or may not deprecate query operators and tools. If you’re using a lot of features, there’s a good chance some of your queries will need to changed. Features may also be shelved but in most cases there is a replacement feature or a workaround that can be implemented.
Since you are using an older version of MongoDB, your driver might already be out of date. New drivers offer new features and can improve your application and user experience. You might have to update your driver in advance. Sometimes, this can be painful because a driver upgrade involves dependencies so other components/frameworks might need an upgrade as well.
For all the reasons listed above, we always recommend testing a new major version before upgrading.
Here are some things we look at when figuring out how long an upgrade to an instance will take:
- Code language
- Driver version
- Code compatibility, like deprecated operators
- MongoDB version constraints (dataset compatibility checks)
Why upgrading is important
There are several reasons to keep upgrading MongoDB. Deprecated versions won’t get backported when comes to bugs. Each version involves hundreds of bugs. For example, there have been more than 150 bug fixes related to the database engine and more than 280 other enhancements and improvements for version 3.4 alone. If you’re still not convinced, check out the new features/improvements section for select improvements.
MongoDB version 3.0
- Introduction of MMAPv1 – MMAP storage engine was refactored to support collection-level locking vs. database-level locking in 2.6. This change increases concurrency and throughput.
- Introduction of WiredTiger – Even if we don’t recommend WiredTiger in 3.0 version, it is the first version that supported the new storage engine. WiredTiger offers document-level locking and compression of data and indexes.
MongoDB version 3.2
- General improvements for the WiredTiger storage engine.
- Read Concern provides isolation level for reads. (This was the first step for Linearizable read concern in 3.4.)
- Partial Indexes provides more flexible indexes and requires less storage while covering the queries better. Read our blog: MongoDB Partial Indexes – Is It Time To Rethink Your Indexing Strategy?
- Document validation provides the capability to validate documents during updates and insertions.
- Aggregation runs faster on sharded clusters
- Geo Indexes v3 for faster Geo Lookups
MongoDB version 3.4
- General improvements for the WiredTiger storage engine.
Linearizable read concern – Critical to financial/bank applications for read accuracy.
- Faster balancing – Important for scaling faster. Move more chunks in parallel.
- Improved initial sync – Makes weekly compaction to run faster.
- Decimal support – Makes working with decimals much easier. No workarounds necessary.
- Aggregation stage for recursive search – Important for commerce applications. Allows faster search.
- Views – Adds another layer of security. Read our blog: Enhance Your Organization’s Security with MongoDB Views
- Improved performance and security. In 3.4, there have been more than 150 bug fixes related to the database engine and more than 280 other enhancements and improvements.
Why we recommend 3.4
We currently support 3.6.4 on our platform as Early Access. At ObjectRocket, we always run extensive tests before removing that early access tag. There are several known issues in 3.6 that we are still in the process of evaluating, so we recommend 3.4 at the moment. When we release 3.6 as GA on our platform, we’ll provide an update to our customers.
Future MongoDB releases
We expect 4.0 to be released somewhere between Q3 and Q4. Exciting new features are coming such as ACID transactions in replica sets. However, it’s likely that 4.0 will remove the MMAPv1 storage engine. More on 4.0 on a future blog. Check out upcoming release details.
What happens next
Set up a call with the ObjectRocket support team so we can begin a plan that fits your needs. We can help you get ahead of potential problems and avoid unplanned maintenance. We’ll help you figure out if you’ll need to plan development updates, update driver settings, and/or set up maintenance windows.