Punchcast CTO Nick Stott on “Why Mongo”?
Mongo is great, and I really, really like Mongo, the syntax is clean, it’s well documented, there are good quality drivers for every language from go to Scala to PHP, it’s rapidly evolving into a universal tool. Mongo also solves a number of scaling problems really well.
If we were to take an application backed by a MySQL database and try to scale this up, lets say by increasing the number of reads per second, then this is a fairly well understood problem. You can have master-slave replication, and increase the number of machines in your pool of slaves. Problem solved. Now if we were to increase the writes, we have a few options, we can throw more hardware at the database and scale vertically, or we can do something called master-master replication, and increase our write throughput that way. Or we can shard our application, and even though MySQL has built in support for partitioning of data, it’s a challenge to write a robust sharding layer in your application. This is where the pain sets in. Sharding is really the way to go, but it’s a difficult problem to solve, and sharding data on an application that’s already running with live data can be an awful experience.
Mongo is different though, increasing read capacity is just as easy as it is with MySQL using something called Replica Sets, writes will all go to the master, and reads will all come from slaves, with the added bonus that the application doesn’t have to know, or even care which is a master and which is a slave. Scaling writes are a piece of cake as well since Mongo comes with a robust auto sharding feature which handles the pain points very well. When we need to increase our write capacity, we add more nodes, it’s that simple. Our application is blissfully unaware how the sharding is set up.
The syntax is unusual, working outside the realm of ‘normal’ relational databases is a bit of a learning curve as well, but these are minor problems and easily overcome.
-Nick Stott CTO of Punchcast
Here’s Nick telling us all about what he does @Punchcast.