MongoDB 3.4 was released on Nov 29, 2016 withÂ tons of new features.Â In this post, I will be listing the top 3 reasons to upgrade to MongoDB 3.4.
In the previous releases, it takes ages(4s per chunk, last I seen in 3.2.10) for the balancer to move or pre-split chunks. Imagine if you have 100,000 chunks to pre-split, it's going to take days. There are 2 reason for this:
- In a sharded cluster, there can only be 1 chunk migration at any point of time. It's a single threaded operation
In MongoDB 3.4,Â for a sharded cluster with n shards, MongoDB can perform at most n/2 (rounded down) simultaneous chunk migrations. So, if you have a 4 shard MongoDB cluster, it will migrate 2 chunks at a time! If you have lesser than 4 shards, the behaviour will stay the same unfortunately. :(
In general, MongoDB has various readConcern option. These options allow the developers to choose different readConcern suitable for their application requirement. Do useÂ readConcern:local for unimportant queries that doesn't careÂ if it reads data that could be rolled back. Using readConcern:majority preventsÂ readingÂ data that can be rolled back. However, it does not prevent you from reading stale data in unique network partitions edge cases.
In MongoDB 3.4, usingÂ readConcern:linearizable allows you to prevent stale reads too. This featureÂ is not free and has the highest performance overhead.Â readConcern:local only require 1 operation to return your results.Â readConcern:majority requires a majority acknowledgement from a majority of the nodes in your replica set which depends on your network latency.Â readConcern:linearizable requires an additionalÂ no-op majority write to the replica set to ensure the data being read is durable and not stale.
In essence, what readConcern:linearizable does is the following:
- Client sends query to primary node
- Node gets the results without erroors
- Node sends a noop majority write to the other nodes in the cluster to confirm that it is still the primary node.
- Results gets returned to the client
I'm not sure why this wasn't publicise widely as a new feature. I like it a lot because, now all the traffic between mongos/mongod are compressed so we save on bandwidth. This really saves you lots of money if you are running it on AWS or if you are constrained by the network bandwidth.
In general, I do agree with infoworld that MongoDB 3.4 is a no-brainer upgrade! We are currently waiting on it to be available on our O/SÂ of choice so we can start rolling it out!
Hope this helps! :)