mongodb datacenter awareness (mongosf2012)

16

Click here to load reader

Upload: scott-hernandez

Post on 25-May-2015

3.837 views

Category:

Technology


1 download

DESCRIPTION

Datacenter awareness in general and specifically with mongodb 2.0 and 2.2

TRANSCRIPT

Page 1: MongoDB Datacenter Awareness (mongosf2012)

Data Center AwarenessScott Hernandez, 10gen

Page 2: MongoDB Datacenter Awareness (mongosf2012)

Agenda

● Infrastructure● Players and moving pieces● Goals and challenges● MongoDB solutions

○ Now (Replication, Sharding, Tagging)○ Future (+=, Shard affinity, more Tagging)

Page 3: MongoDB Datacenter Awareness (mongosf2012)

Multiple Online Data Centers

● Europe○ App○ Data

● Asia

○ App

● USA○ App○ Data

Page 4: MongoDB Datacenter Awareness (mongosf2012)

Infrastructure

● Geographically disparate clients● Geo-DNS/Load Balancer (LB)● Accelerators/Reverse-Proxies● Server/Application

Page 5: MongoDB Datacenter Awareness (mongosf2012)

Players Introduction

● Users ● Data Centers

○ Application Servers○ Databases

● Application Awareness

○ Configuration○ Why?

Page 6: MongoDB Datacenter Awareness (mongosf2012)

Goals

● Reduce network○ latency○ Inter-dc traffic

● Localize resource use○ Reduce failure cases○ Increase availability○ Isolate dependencies

● Provide multiple active sites● Partition geo/regional data

Page 7: MongoDB Datacenter Awareness (mongosf2012)

Challenges

● Data concistency○ User experience○ Backup and operational needs

● Scaling● Partitioning/Sharding

Page 8: MongoDB Datacenter Awareness (mongosf2012)

Multiple Online Data Centers

● Europe○ App○ Data

● Asia

○ App

● USA○ App○ Data

Page 9: MongoDB Datacenter Awareness (mongosf2012)

Non-default behaviors

Default:● Primary read/write● No stale reads

Multi-DC needs:● Read locally● Support some stale

reads

Page 10: MongoDB Datacenter Awareness (mongosf2012)

Replication

● Replica Sets○ Possible to read from non-primary replicas○ Copy of data○ Write Concern

■ Tagging■ Verifiable writes

● Provides

○ Isolation (possible stale reads)○ Availability○ Distribution of read, possibly stale (WriteConcern)

Page 11: MongoDB Datacenter Awareness (mongosf2012)

Replica Writes

Client USA-NY

USA-CA

EUROPE

Write Replica_Safe

Ack

ClientQuery

Page 12: MongoDB Datacenter Awareness (mongosf2012)

Tagged Writes

Uses● Multiple Racks/DCs● Backups● Disaster Recovery

Page 13: MongoDB Datacenter Awareness (mongosf2012)

Sharding + Replication

● Range-based sharding (chunks)○ Not tag aware○ Random distribution (balancer)

● Shards made up of Replica Sets○ All advantages

● Writes to (primary) shard per chunk● Reads

○ From Primary by default○ Optional non-primary reads

Page 14: MongoDB Datacenter Awareness (mongosf2012)

New Features

● ReadPreference○ Primary (only)○ Secondary (preferred)○ PrimaryFirst?○ SecondayOnly?○ Any (closest)

● Replica Sets

○ ReadPreference● Sharding

○ Tagged balancing○ ReadPreference

Page 15: MongoDB Datacenter Awareness (mongosf2012)

Sharding - Reads

● Local when non-primary● Tagged

○ Custom Tagging○ By region/dc/rack?

Page 16: MongoDB Datacenter Awareness (mongosf2012)

Sharding - Balancing/Distribution

● Tag chunks/ranges● Possible super-chunks (grouping)