Growing MongoDB on AWS

Post on 15-Jan-2015

841 views 7 download

Tags:

description

 

transcript

Growing MongoDBon AWSColin Howe@colinhowe

Who am I?

I run engineering at Conversocial.We help companies do social customer service.http://www.conversocial.com

Love coding, ultimate frisbee and pudding

Growing MongoDB on AWS

Tips for ensuring you can grow MongoDB on AWS as your business needs grow.

Mandatory meaningless graph

Single Server - Ephemeral

Single server with instance storage.Not really advised.

Must haves:● Journalling

http://www.mongodb.org/display/DOCS/Journaling

● Regular backupshttp://www.mongodb.org/display/DOCS/Backups

Single Server - Ephemeral

Pros:Easy to configure.Cheap.

Cons:No redundancy.Data since last backup is lost on server death.

Single Server - EBS

Same as the last but move storage over to EBS.

EBS is slow.RAID 10 it. http://bit.ly/mongodb-raid10

Single Server - EBS

Pros:Easy to configure.Data should still be available on server death.Cheapish.

Cons:No redundancy.

Single Server - No redundancy

Enter Replication

Primary server replicates to secondary servers

Use multiple Availability Zones (AZs).

Two servers, one arbiter

Cheapest replica set configuration.

Arbiter ensures an odd number of votes.

The arbiter can be a micro instance.

Two servers, one arbiter

Pros:Cheapish.Some failover.

Cons:Only one failover. What if you fail again?

Three servers

Standard replica set configuration.

Three servers

Pros:Lots of redundancy.High read capacity when one server fails.

Cons:Starts to get pricey.

Where next?

Horizontal and vertical scaling.

Vertical scaling

Use EBS boot.

Turn the server off. Resize. Turn it back on.

Seconds of downtime when using a replica set.

Without replica sets you will have downtime

Vertical scaling - SSDs

If you can afford them SSDs are the King.

● Conversocial got 43% faster.

● 90% iowait went to ~3% user, 0% iowait.

All numbers compared to instance with largest memory (68.4gb)

Horizontal read scaling

Add more secondaries and use slave queries.

Really easy.

Make sure you have a hidden backup server. Backups kill read performance.

Use write concerns for consistent reads.

Horizontal write scaling - Sharding

Fairly easy with MongoDB.

Backups get harder.

More to manage and configure. Automate it.

When to Shard?

If you know your data structure then sooner

If you don't... later

Changing shard keys is not trivial

Enterprise Availability

If you're hunting for the final decimal places of availability...

You're probably going to break your application more frequently than Amazon has a whole region outage.

But...

Enterprise Availability

Multiple regions are the next step.

Harder as you go outside the firewall.

VPNs or SSH tunnels are your friend here.

Tools to Help You

MMS - Mongo's Monitoring System (FREE)

Chef/Puppet - automate as much as you can

#mongodb and MongoDB user group

10gen

Thanks for Listening!Any questions?

Feeling shy?You can always reach me on Twitter

@colinhowe

Slides will be put online