SlideShare a Scribd company logo
SoftwarePeople
Md Khairul Anam
Introduction to Availability &
Scalability in MongoDB
Availability
Replica Set – Creation
Replica Set – Initialize
Replica Set – Failure
Replica Set – Failover
Replica Set – Recovery
Replica Set – Recovered
Replica Set Roles
‱ Heartbeats
‱ Priority Comparisons
‱ Optime
‱ Connections
‱ Networka Partitions
Factors and Conditions that Affect Elections
Strong Consistency
Delayed Consistency
Maintenance and Upgrade
‱ Rolling upgrade/maintenance
– Start with Secondary
– Primary last
Replica Set – 1 Data Center
Single datacenter
Single switch & power
Points of failure:
– Power
– Network
– Data center
Automatic recovery of
single node crash
Replica Set – 2 Data Centers
Multi data center
DR node for safety
Can’t do multi data
center durable write
safely since only 1 node
in distant DC
Replica Set – 3 Data Centers
Three data centers
Can survive full data
center loss
Can do w= { dc : 2 } to
guarantee write in 2 data
centers
Questions?
Scalability
User Growth
– 1995: 0.4% of the world’s population
– Today: 30% of the world is online (~2.2B)
Data Set Growth
– Facebook’s data set is around 100 petabytes
– 4 billion photos taken in the last year (4x a decade ago
Examining Growth
Read/Write Throughput
Exceeds I/O
Working Set
In
d
e
x
e
s
D
a
t
a
Working Set
Indexes Data
Working Set Exceeds
Physical Memory
Vertical Scalability
(Scale Up)
Horizontal Scalability (Scale Out)
Custom Hardware
– Oracle
Custom Software
– Facebook + MySQL
– Google
MongoDB Auto-Sharding
Adata store that is
– Free
– Publiclyavailable
– Open Source(https://github.com/mongodb/mongo)
– Horizontallyscalable
– Applicationindependent
Data Store Scalability Solutions
Sharded Cluster Architecture
‱ Shard is a node of the cluster
‱ Shard can be a single mongod or a replica
set
What is a Shard?
Config Server
– Stores cluster chunk ranges and locations
– Can have only 1 or 3 (production must have 3)
– Not a replica set
Meta Data Storage
Mongos
– Acts as a router / balancer
– No local data (persists to config database)
– Can have 1 or many
Routing and Managing Data
‱ User defines shard key
‱ Shard key defines range of data
‱ Key space is like points on a line
‱ Range is a segment of that line
Partitioning
‱ Shard key is used to partition your collection
‱ Shard key must exist in every document
‱ Shard key must be indexed
‱ Shard key is used to route requests to shards
What is a Shard Key
Shards and Shard Keys
Shard
Shard key
range
‱ Initially 1 chunk
‱ Default max chunk size: 64mb
‱ MongoDB automatically splits & migrates
chunks when max reached
Data Distribution
‱ Targeted Queries
‱ Scatter Gather Queries
‱ Scatter Gather Queries with Sort
Cluster Request Routing
Questions?
Thank You

More Related Content

PDF
Evolution of MongoDB Replicaset and Its Best Practices
PPT
High Availabiltity & Replica Sets with mongoDB
PPTX
Introducing MongoDB in a multi-site HA environment
PDF
Postgres connections at scale
PPTX
Mongo db multidc_webinar
PDF
Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...
PDF
Loadays MySQL
PPT
Intro to MySQL Master Slave Replication
Evolution of MongoDB Replicaset and Its Best Practices
High Availabiltity & Replica Sets with mongoDB
Introducing MongoDB in a multi-site HA environment
Postgres connections at scale
Mongo db multidc_webinar
Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...
Loadays MySQL
Intro to MySQL Master Slave Replication

What's hot (20)

PDF
Write on memory TSDB database (gocon tokyo autumn 2018)
 
PDF
Tool it Up! - Session #3 - MySQL
PDF
PostgreSQL Replication High Availability Methods
PDF
Distributed Tracing, from internal SAAS insights
 
PPTX
January 2011 HUG: Pig Presentation
PDF
TokuDB internals / Đ›Đ”ŃĐžĐœ ВлаЎОслаĐČ (Percona)
 
PDF
MySQL database replication
PPTX
Mysql data replication
PDF
Setting up mongodb sharded cluster in 30 minutes
PPTX
Introduction to HDFS
PDF
MySQL shell and It's utilities - Praveen GR (Mydbops Team)
PPTX
Running MongoDB 3.0 on AWS
PPTX
Understanding How CQL3 Maps to Cassandra's Internal Data Structure
PDF
Using ZFS file system with MySQL
PDF
Analytics at Speed: Introduction to ClickHouse and Common Use Cases. By Mikha...
PDF
In-core compression: how to shrink your database size in several times
PDF
Scaling symfony apps
PDF
Development to Production with Sharded MongoDB Clusters
PPTX
Building Scalable Web Apps - LVL.UP KL
PDF
MySQL Live Migration - Common Scenarios
Write on memory TSDB database (gocon tokyo autumn 2018)
 
Tool it Up! - Session #3 - MySQL
PostgreSQL Replication High Availability Methods
Distributed Tracing, from internal SAAS insights
 
January 2011 HUG: Pig Presentation
TokuDB internals / Đ›Đ”ŃĐžĐœ ВлаЎОслаĐČ (Percona)
 
MySQL database replication
Mysql data replication
Setting up mongodb sharded cluster in 30 minutes
Introduction to HDFS
MySQL shell and It's utilities - Praveen GR (Mydbops Team)
Running MongoDB 3.0 on AWS
Understanding How CQL3 Maps to Cassandra's Internal Data Structure
Using ZFS file system with MySQL
Analytics at Speed: Introduction to ClickHouse and Common Use Cases. By Mikha...
In-core compression: how to shrink your database size in several times
Scaling symfony apps
Development to Production with Sharded MongoDB Clusters
Building Scalable Web Apps - LVL.UP KL
MySQL Live Migration - Common Scenarios
Ad

Viewers also liked (9)

PPTX
Performance Tuning and Optimization
PPTX
Agility and Scalability with MongoDB
PPT
MongoDB Basic Concepts
PDF
Indexing
PPTX
Trading up: Adding Flexibility and Scalability to Bouygues Telecom with MongoDB
PDF
Inside MongoDB: the Internals of an Open-Source Database
KEY
MongoDB: How it Works
PPTX
Scaling and Transaction Futures
PPTX
Developing with the Modern App Stack: MEAN and MERN (with Angular2 and ReactJS)
Performance Tuning and Optimization
Agility and Scalability with MongoDB
MongoDB Basic Concepts
Indexing
Trading up: Adding Flexibility and Scalability to Bouygues Telecom with MongoDB
Inside MongoDB: the Internals of an Open-Source Database
MongoDB: How it Works
Scaling and Transaction Futures
Developing with the Modern App Stack: MEAN and MERN (with Angular2 and ReactJS)
Ad

Similar to Availability and scalability in mongo (20)

PDF
Sharding in MongoDB Days 2013
PDF
Scaling MongoDB - Presentation at MTP
PPTX
Introduction to Sharding
KEY
2011 mongo sf-scaling
PPTX
Back to Basics: Build Something Big With MongoDB
PPTX
Introduction to Sharding
PPTX
Back tobasicswebinar part6-rev.
PPTX
Sharding
PPTX
Webinar: Serie Operazioni per la vostra applicazione - Sessione 6 - Installar...
KEY
Scaling with MongoDB
KEY
Sharding with MongoDB (Eliot Horowitz)
PPTX
Webinar: Sharding
PPTX
MongoDB : Scaling, Security & Performance
KEY
Scaling MongoDB (Mongo Austin)
PPTX
Sharding - Seoul 2012
PDF
Sharding
KEY
Sharding with MongoDB (Eliot Horowitz)
PPT
2011 mongo FR - scaling with mongodb
PPTX
MongoDB San Francisco 2013: Basic Sharding in MongoDB presented by Brandon Bl...
PDF
MongoDB Sharding
Sharding in MongoDB Days 2013
Scaling MongoDB - Presentation at MTP
Introduction to Sharding
2011 mongo sf-scaling
Back to Basics: Build Something Big With MongoDB
Introduction to Sharding
Back tobasicswebinar part6-rev.
Sharding
Webinar: Serie Operazioni per la vostra applicazione - Sessione 6 - Installar...
Scaling with MongoDB
Sharding with MongoDB (Eliot Horowitz)
Webinar: Sharding
MongoDB : Scaling, Security & Performance
Scaling MongoDB (Mongo Austin)
Sharding - Seoul 2012
Sharding
Sharding with MongoDB (Eliot Horowitz)
2011 mongo FR - scaling with mongodb
MongoDB San Francisco 2013: Basic Sharding in MongoDB presented by Brandon Bl...
MongoDB Sharding

Recently uploaded (20)

PDF
Understanding Forklifts - TECH EHS Solution
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PPTX
Introduction to Artificial Intelligence
PPTX
Essential Infomation Tech presentation.pptx
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
 
PDF
System and Network Administraation Chapter 3
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
history of c programming in notes for students .pptx
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
L1 - Introduction to python Backend.pptx
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Odoo Companies in India – Driving Business Transformation.pdf
Understanding Forklifts - TECH EHS Solution
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
How to Choose the Right IT Partner for Your Business in Malaysia
PTS Company Brochure 2025 (1).pdf.......
Navsoft: AI-Powered Business Solutions & Custom Software Development
Introduction to Artificial Intelligence
Essential Infomation Tech presentation.pptx
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
 
System and Network Administraation Chapter 3
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Reimagine Home Health with the Power of Agentic AI​
Wondershare Filmora 15 Crack With Activation Key [2025
Which alternative to Crystal Reports is best for small or large businesses.pdf
history of c programming in notes for students .pptx
VVF-Customer-Presentation2025-Ver1.9.pptx
Softaken Excel to vCard Converter Software.pdf
L1 - Introduction to python Backend.pptx
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Odoo Companies in India – Driving Business Transformation.pdf

Availability and scalability in mongo

Editor's Notes

  • #4: Basic explanation 2 or more nodes form the set Quorum
  • #5: Initialize -> Election Primary + data replication from primary to secondary
  • #6: Primary down/network failure Automatic election of new primary if majority exists
  • #7: New primary elected Replication established from new primary
  • #8: Down node comes up Rejoins sets Recovery and then secondary
  • #10: Primary Data member Secondary Hot standby Arbiters Voting member
  • #16: A good question to ask the audience : 'Why wouldn't you set w={dc:3}'
 Why would you ever do that? What would be the complications?
  • #18: Consistency Write preferences Read preferences
  • #20: A good question to ask the audience : 'Why wouldn't you set w={dc:3}'
 Why would you ever do that? What would be the complications?