MongoDB on AWS: How to Choose the Right EC2 Instance Type for Your MongoDB Server?

Let’s face it. AWS has gotten incredibly complicated. A simple task like picking the right instance type for your MongoDB on AWS requires a fair bit of research. How do you know which server type to choose in the alphabet soup of options? In this blog post, we’ll break down the different instance types and how they’re applicable to your MongoDB scenarios. In order to keep things simple, we’re not going to talk about disk types or sizes in this post – but don’t worry, that’s the topic of our next post.

1. Low Memory Instances: (T1.Micro, M1.Small)

These types of instances are mostly used for development and testing. Due to the small amount of memory, it’s unlikely you’ll want to use them in a real production scenario. but they are good candidates for “Arbiters” in your replica set. Also, T1.Micro instances qualify for the free usage tier of AWS (750 hours/month free for a year).

2. General Purpose Instances: (M3.Medium – M3.XLarge)

General Purpose instances are excellent starter instances for your MongoDB Server. If you’re just getting started or unsure of the amount of memory you’ll need, these are great instances to kick off with. As your needs increase, you can move to the High Memory or High IO instances. The previous generation of General Purpose instances used to be called M1.

3. High Memory Instances: (R3.Large – R3.8xLarge)

These instances are the sweet spot for your MongoDB instances. They have the right balance of memory and compute power, and are good candidates to run your larger MongoDB server. MongoDB is mainly a memory game – the more memory you supply, the better it works and these instance types offer the most memory. The previous generation of these instances used to be called M2. If your MongoDB server is still getting disk bound, then I would consider the High IO instances.

4. High IO Instances: (I2.xlarge – I2.8xLarge, HS1)

These are the “Cadillacs” of the EC2 world, and you can run your most demanding MongoDB servers on these instances. They provide a high amount memory and fast local SSDs. As you can imagine, they do cost a pretty penny. The local SSDs have a few caveats that you need to be aware of, and we’re going to discuss this in an upcoming post of disk options.

5. High Compute Instances: (c3.large-c38xlarge)

These instances provide the best CPU performance for their price. However, MongoDB does not need a lot of CPU, and we’ve rarely found these to be useful. We prefer the High Memory and High IO instances to run our MongoDB databases.

As always if you have other questions, email us at support@scalegrid.io.

Here are some other relevant articles if you’re hosting MongoDB on AWS:


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


2 Shares
+11
Tweet
Share
Share1
Pin