SlideShare a Scribd company logo
1 of 66
#MongoDBDays 
5 Things you need to know 
about Administering MongoDB 
Alvin Richards 
Senior Director of Performance Engineering, MongoDB
#MongoDBDays 
Or… 
A Dev and Ops "Love Story" 
Alvin Richards 
Senior Director of Performance Engineering, MongoDB
Before we start… 
• I'm assuming you have at least 
– installed MongoDB 
– Have done some basic Admin 
• I'm not assuming you have 
– Been running in production for any length of time
Dev are from Mars and Ops are from 
Venus… 
DEV OPS
5 Things you need to know 
1. Know Thy Beast 
2. Protecting data 
3. Scaling Writes & Reads 
4. Monitoring 
5. Backing up & Restoring
#1 
Know thy beast
Architecture 
• Shipped as Binaries 
• tarball, zip file 
• Packages(rpm, yum) 
• MSI (for Windows) 
• Runs a background process mongod (or 
mogod.exe) 
• Uses Memory Mapped Files
Memory Mapped files – dude whoa 
• To MongoDBmemory is an infinite-ish pool 
• 64 TB Linux / Windows 2012 R2 / Windows 8.1 
• 4 TB earlier Windows versions 
• MongoDB accesses memory locations in virtual 
memory 
• O/S may have to page in that data from storage 
• O/S may have to page out data from RAM 
• Physical RAM acts as a LRU cache
Collection 
1 
Index 1
Virtual 
Address 
Space 1 
Collection 
1 
Index 1 
This is your virtual 
memory size (mapped)
Physical 
RAM 
Collection 
1 
Index 1 
This is your 
resident memory 
size 
Virtual 
Address 
Space 1
Collection Disk 
1 
Physical 
RAM 
Index 1 
Virtual 
Address 
Space 1
Collection Disk 
1 
Physical 
RAM 
Index 1 
100 ns 
10,000,000 ns 
= 
= 
Virtual 
Address 
Space 1
What Memory is used for 
• Working Set 
– Active Data & Indexes in Memory 
• Sorting 
• Aggregation & Map/Reduce 
• Connections
Working Set Exceeds Physical 
Memory
Where can I find this info? 
> db.serverStatus( { workingSet: 1 } ) 
… 
"workingSet" : { 
"note" : "thisIsAnEstimate", 
"pagesInMemory" : 378, 
"computationTimeMicros" : 4104, 
"overSeconds" : 4646 
},
Where can I find this info? 
> mongostat 
… 
Insert query update delete getmore command flushes mapped vsize res 
*0 *0 *0 *0 0 1|0 0 160m 2.75g 5m 
*0 *0 *0 *0 0 1|0 0 160m 2.75g 5m 
> iostat 
> sar 
> vmstat 
Windows: Perfmon
#2 
Protecting data
Deployment - Single Node 
Good 
• Write ahead journaling for 
crash protection 
Bad 
• Cannot survive loss of 
one node 
Primary – A
Oppps 
http://i.ytimg.com/vi/PzWK9QCYgH8/hqdefault.jpg
Replica Set – Initialize
Replica Set – Failure
Replica Set – Failover
Replica Set – Recovery
Replica Set – Recovered
Oops… Multiple Failures 
http://f1-grandprix.com/wp-content/uploads/wppa/565.jpg
Deployment–Single Data Center 
Good 
• Automated failover 
• Tolerates server failures 
• Tolerates rack failures 
• Number of replicas 
defines failure tolerance 
Bad 
• Cannot survive loss of 
Data Center 
Primary – A 
Secondary – B 
Secondary – C
Deployment - Active/Active Data 
Center 
US-B 
Data Center - US 
US-A 
EU-C 
EC-D 
ASIA-E 
Data Center - Europe Data Center - Asia 
Good 
• Tolerates server, rack, data center failures, network 
partitions 
Bad 
• Complexity but "MMS Automation to the rescue" ™
Useful commands 
> rs.status() 
{ 
"set" : "foo", 
"date" : ISODate("2014-09-08T01:29:58Z"), 
"myState" : 1, 
"members" : [ 
{ 
"_id" : 0, 
"name" : "vero.local:31000", 
"health" : 1, 
"state" : 1, 
"stateStr" : "PRIMARY", 
"uptime" : 28,
Useful commands 
> rs.printReplicationInfo() 
configured oplog size: 192MB 
log length start to end: 0secs (0hrs) 
oplog first event time: Sun Sep 07 2014 18:17:52 GMT-0700 (PDT) 
oplog last event time: Sun Sep 07 2014 18:29:52 GMT-0700 (PDT) 
now: Sun Sep 07 2014 18:30:49 GMT-0700 (PDT)
Application Considerations 
Dev Ops
Tunable Data Durability 
Memory Journal Secondar 
y 
Other Data Center 
RDBMS 
w=1 
j=true 
w="majority 
" 
w=n 
w="myTag 
" 
Latenc 
y 
async 
sync 
Durability
#3 
Scaling Writes & Reads
#3.1 
Scaling Writes
Sharding - Range distribution 
sh.shardCollection("test.tweets", {user: 1} , false) 
shard01 shard02 shard03
Sharding - Range distribution 
shard01 shard02 shard03 
a-i j-r s-z
Shard Key Options 
• Single or Compound Key 
• Regular or Hashed key 
• Tagged
Sharding – Auto Splits 
shard01 shard02 shard03 
a-i ja-jz s-z 
k-r
Sharding – Auto Splits 
shard01 shard02 shard03 
a-i ja-ji s-z 
ji-js 
js-jw 
jz-r
Sharding - Auto Balancing 
shard01 shard02 shard03 
a-i ja-ji s-z 
ji-js 
js-jw 
jz-r 
js-jw 
jz-r
Sharding - Goal Equilibrium 
shard01 shard02 shard03 
a-i ja-ji s-z 
ji-js 
js-jw 
jz-r
Sharding - Find by Shard Key 
find({user: "alvin"}) 
shard01 shard02 shard03 
a-i ja-ji s-z 
ji-js 
js-jw 
jz-r
Sharding - Find by Attribute 
find({email: "alvin@10gen.com"}) 
shard01 shard02 shard03 
a-i ja-ji s-z 
ji-js 
js-jw 
jz-r
Application Considerations 
Dev Ops
Shard Key 
• What key to use? 
• Plain or Hashed? 
• What's the distribution & usage? 
• Predicate & Sorts 
– Use the Shard key? 
– Scatter Gather + Sort?
Useful commands 
> sh.status() 
... 
shards: 
{ "_id" : "shard0000", "host" : "localhost:29001", "tags" : [ 
"dc-emea" ] } 
{ "_id" : "shard0001", "host" : "localhost:29002", "tags" : [ 
"dc-asia" ] } 
{ "_id" : "shard0002", "host" : "localhost:29003", "tags" : [ 
"dc-na" ] } 
databases: 
{ "_id" : "scaleout", "partitioned" : true, "primary" : 
"shard0000" } 
scaleout.blogs 
shard key: { "loc" : 1 } 
chunks: shard0000 1 
{ "loc" : { "$minKey" : 1 } } -->> 
{ "loc" : { "$maxKey" : 1 } } on : shard0000 Timestamp(1, 
0)
Useful commands 
// Commands to start/Stop the balancer 
> sh.startBalancer() 
> sh.stopBalancer() 
// Disable balancing for a specific collection 
> sh.disableBalancing("students.grades") 
// Runt the balancer during a specific time window 
> db.settings.update({ _id : "balancer" }, 
{ $set : { activeWindow : { start : "<start-time>", 
stop : "<stop-time>" } } }, true )
#3.2 
Scaling Reads
Immediate vs. Eventual 
Consistency 
• Do you want to read your own writes? 
– Use Sharding to Scale Reads 
• Are you tolerant to read older versions of data? 
– May read from Secondary's
Application Considerations 
Dev Ops
Immediate Consistency 
Thread #1 Primary 
Insert 
Read 
Update 
Read 
v1 
✔ 
v2 
✔
Eventual Consistency 
Thread #1 Primary Secondary 
Insert 
Read 
v1 
Thread #2 
✖ 
v1 
v1 does not 
exist 
reads v1 
Update 
Read 
v2 
✖ 
v2
Eventual Consistency with a Write 
Concern 
Thread #1 Primary Secondary 
Insert (w=2) 
Read 
v1 
Thread #2 
✖ 
v1 does not 
exist 
v1 reads v1 
✔
#4 
Monitoring
Pick your tool dejour 
• Plugins for 
– Cacti, Zabix, Munin, NewRelic…. 
• MongoDB Monitoring (MMS) 
– mms.mongodb.com 
– Focused on MongoDB cluster well being
MMS
KPIs you care about 
• MongoDB 
– MongoDB ops/sec 
– Read/Write queues 
– Index Misses 
– Locked % 
– Flush times 
– Replication Lag
KPIs you care about 
• Storage 
– IOPS 
– Size 
– Data & Loading Patterns 
• Memory 
– Working Set 
• CPU 
– Speed 
– Cores 
• Network 
– Latency 
– Throughput
Example 
MongoDB 
ops/sec 
Page Faults / 
Sec
#5 
Backup & Restore
Options 
• mongodump / mongorestore 
• File system snaphot / rsync 
• MMS Backup 
– Automated Cluster Backup / Restore 
– Snapshots 
– Point in Time recovery 
– OpLog based
MMS Backup & Restore
Other talks today 
• 10.25 – Running MongoDB with confidence with 
MMS 
• 12.45 –MongoDB Sharding 
• 1.05 – Securing Your MongoDB Deployment 
• 4.10 – Diagnostics and Debugging
Get MongoDB Certified 
• 20% off our October exam with the code 
• MongoDBSeattle20 
• TODAY ONLY 
• university.mongodb.com
A happy ever after? 
Dev Ops
#MongoDBDays 
Thank You 
Alvin Richards 
alvin@mongodb.com / @jonnyeight 
Senior Director of Performance Engineering, MongoDB

More Related Content

What's hot

Advanced Sharding Features in MongoDB 2.4
Advanced Sharding Features in MongoDB 2.4 Advanced Sharding Features in MongoDB 2.4
Advanced Sharding Features in MongoDB 2.4
MongoDB
 
glance replicator
glance replicatorglance replicator
glance replicator
irix_jp
 
DataStax | Advanced DSE Analytics Client Configuration (Jacek Lewandowski) | ...
DataStax | Advanced DSE Analytics Client Configuration (Jacek Lewandowski) | ...DataStax | Advanced DSE Analytics Client Configuration (Jacek Lewandowski) | ...
DataStax | Advanced DSE Analytics Client Configuration (Jacek Lewandowski) | ...
DataStax
 
Kicking ass with redis
Kicking ass with redisKicking ass with redis
Kicking ass with redis
Dvir Volk
 
MongoDB Performance Tuning and Monitoring
MongoDB Performance Tuning and MonitoringMongoDB Performance Tuning and Monitoring
MongoDB Performance Tuning and Monitoring
MongoDB
 

What's hot (20)

Back to Basics Webinar 6: Production Deployment
Back to Basics Webinar 6: Production DeploymentBack to Basics Webinar 6: Production Deployment
Back to Basics Webinar 6: Production Deployment
 
Top Node.js Metrics to Watch
Top Node.js Metrics to WatchTop Node.js Metrics to Watch
Top Node.js Metrics to Watch
 
[2C6]SQLite DB 의 입출력 특성분석 : Android 와 Tizen 사례
[2C6]SQLite DB 의 입출력 특성분석 : Android 와 Tizen 사례[2C6]SQLite DB 의 입출력 특성분석 : Android 와 Tizen 사례
[2C6]SQLite DB 의 입출력 특성분석 : Android 와 Tizen 사례
 
Advanced Apache Cassandra Operations with JMX
Advanced Apache Cassandra Operations with JMXAdvanced Apache Cassandra Operations with JMX
Advanced Apache Cassandra Operations with JMX
 
PostgreSQL on Solaris
PostgreSQL on SolarisPostgreSQL on Solaris
PostgreSQL on Solaris
 
Advanced Sharding Features in MongoDB 2.4
Advanced Sharding Features in MongoDB 2.4 Advanced Sharding Features in MongoDB 2.4
Advanced Sharding Features in MongoDB 2.4
 
glance replicator
glance replicatorglance replicator
glance replicator
 
Webinar: Performance Tuning + Optimization
Webinar: Performance Tuning + OptimizationWebinar: Performance Tuning + Optimization
Webinar: Performance Tuning + Optimization
 
Beyond PHP - It's not (just) about the code
Beyond PHP - It's not (just) about the codeBeyond PHP - It's not (just) about the code
Beyond PHP - It's not (just) about the code
 
Mythbusting: Understanding How We Measure the Performance of MongoDB
Mythbusting: Understanding How We Measure the Performance of MongoDBMythbusting: Understanding How We Measure the Performance of MongoDB
Mythbusting: Understanding How We Measure the Performance of MongoDB
 
HUG_Ireland_BryanQuinnPresentation_20160111
HUG_Ireland_BryanQuinnPresentation_20160111HUG_Ireland_BryanQuinnPresentation_20160111
HUG_Ireland_BryanQuinnPresentation_20160111
 
DataStax | Advanced DSE Analytics Client Configuration (Jacek Lewandowski) | ...
DataStax | Advanced DSE Analytics Client Configuration (Jacek Lewandowski) | ...DataStax | Advanced DSE Analytics Client Configuration (Jacek Lewandowski) | ...
DataStax | Advanced DSE Analytics Client Configuration (Jacek Lewandowski) | ...
 
Elasticsearch at Dailymotion
Elasticsearch at DailymotionElasticsearch at Dailymotion
Elasticsearch at Dailymotion
 
Gpu programming with java
Gpu programming with javaGpu programming with java
Gpu programming with java
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Kicking ass with redis
Kicking ass with redisKicking ass with redis
Kicking ass with redis
 
DataStax | DSE: Bring Your Own Spark (with Enterprise Security) (Artem Aliev)...
DataStax | DSE: Bring Your Own Spark (with Enterprise Security) (Artem Aliev)...DataStax | DSE: Bring Your Own Spark (with Enterprise Security) (Artem Aliev)...
DataStax | DSE: Bring Your Own Spark (with Enterprise Security) (Artem Aliev)...
 
MongoDB Performance Tuning and Monitoring
MongoDB Performance Tuning and MonitoringMongoDB Performance Tuning and Monitoring
MongoDB Performance Tuning and Monitoring
 
A Detailed Look At cassandra.yaml (Edward Capriolo, The Last Pickle) | Cassan...
A Detailed Look At cassandra.yaml (Edward Capriolo, The Last Pickle) | Cassan...A Detailed Look At cassandra.yaml (Edward Capriolo, The Last Pickle) | Cassan...
A Detailed Look At cassandra.yaml (Edward Capriolo, The Last Pickle) | Cassan...
 
2012 07-24 dnssec-og_open_dnssec_-_martin_toft_og_georg_sluyterman_slideshow
2012 07-24 dnssec-og_open_dnssec_-_martin_toft_og_georg_sluyterman_slideshow2012 07-24 dnssec-og_open_dnssec_-_martin_toft_og_georg_sluyterman_slideshow
2012 07-24 dnssec-og_open_dnssec_-_martin_toft_og_georg_sluyterman_slideshow
 

Viewers also liked

Viewers also liked (12)

"Saving MDL from 100% Growth: How to Leverage MongoDB, MVC, and Angular "
"Saving MDL from 100% Growth: How to Leverage MongoDB, MVC, and Angular  ""Saving MDL from 100% Growth: How to Leverage MongoDB, MVC, and Angular  "
"Saving MDL from 100% Growth: How to Leverage MongoDB, MVC, and Angular "
 
Ops Jumpstart: MongoDB Administration 101
Ops Jumpstart: MongoDB Administration 101Ops Jumpstart: MongoDB Administration 101
Ops Jumpstart: MongoDB Administration 101
 
Ops Jumpstart: Admin 101
Ops Jumpstart: Admin 101Ops Jumpstart: Admin 101
Ops Jumpstart: Admin 101
 
Advanced Administration, Monitoring and Backup
Advanced Administration, Monitoring and BackupAdvanced Administration, Monitoring and Backup
Advanced Administration, Monitoring and Backup
 
Ops Jumpstart: MongoDB Administration 101
Ops Jumpstart: MongoDB Administration 101Ops Jumpstart: MongoDB Administration 101
Ops Jumpstart: MongoDB Administration 101
 
Introduction to MongoDB Enterprise
Introduction to MongoDB EnterpriseIntroduction to MongoDB Enterprise
Introduction to MongoDB Enterprise
 
MongoDB Administration 101
MongoDB Administration 101MongoDB Administration 101
MongoDB Administration 101
 
An Introduction to MongoDB Ops Manager
An Introduction to MongoDB Ops ManagerAn Introduction to MongoDB Ops Manager
An Introduction to MongoDB Ops Manager
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Webinar: Enterprise Data Management in the Era of MongoDB and Data Lakes
Webinar: Enterprise Data Management in the Era of MongoDB and Data LakesWebinar: Enterprise Data Management in the Era of MongoDB and Data Lakes
Webinar: Enterprise Data Management in the Era of MongoDB and Data Lakes
 
Back to Basics: My First MongoDB Application
Back to Basics: My First MongoDB ApplicationBack to Basics: My First MongoDB Application
Back to Basics: My First MongoDB Application
 
An introduction to MongoDB
An introduction to MongoDBAn introduction to MongoDB
An introduction to MongoDB
 

Similar to Ops Jumpstart: MongoDB Administration 101

MongoDB for Time Series Data Part 3: Sharding
MongoDB for Time Series Data Part 3: ShardingMongoDB for Time Series Data Part 3: Sharding
MongoDB for Time Series Data Part 3: Sharding
MongoDB
 
Deployment Strategy
Deployment StrategyDeployment Strategy
Deployment Strategy
MongoDB
 
Deployment Preparedness
Deployment Preparedness Deployment Preparedness
Deployment Preparedness
MongoDB
 
2014 05-07-fr - add dev series - session 6 - deploying your application-2
2014 05-07-fr - add dev series - session 6 - deploying your application-22014 05-07-fr - add dev series - session 6 - deploying your application-2
2014 05-07-fr - add dev series - session 6 - deploying your application-2
MongoDB
 
MongoDB Best Practices in AWS
MongoDB Best Practices in AWS MongoDB Best Practices in AWS
MongoDB Best Practices in AWS
Chris Harris
 
Backup, Restore, and Disaster Recovery
Backup, Restore, and Disaster RecoveryBackup, Restore, and Disaster Recovery
Backup, Restore, and Disaster Recovery
MongoDB
 

Similar to Ops Jumpstart: MongoDB Administration 101 (20)

MongoDB for Time Series Data Part 3: Sharding
MongoDB for Time Series Data Part 3: ShardingMongoDB for Time Series Data Part 3: Sharding
MongoDB for Time Series Data Part 3: Sharding
 
Deployment Strategy
Deployment StrategyDeployment Strategy
Deployment Strategy
 
MongoDB for Time Series Data: Sharding
MongoDB for Time Series Data: ShardingMongoDB for Time Series Data: Sharding
MongoDB for Time Series Data: Sharding
 
Deployment Strategies
Deployment StrategiesDeployment Strategies
Deployment Strategies
 
MongoDB: Optimising for Performance, Scale & Analytics
MongoDB: Optimising for Performance, Scale & AnalyticsMongoDB: Optimising for Performance, Scale & Analytics
MongoDB: Optimising for Performance, Scale & Analytics
 
Replication MongoDB Days 2013
Replication MongoDB Days 2013Replication MongoDB Days 2013
Replication MongoDB Days 2013
 
Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...
Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...
Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...
 
Deployment Strategies (Mongo Austin)
Deployment Strategies (Mongo Austin)Deployment Strategies (Mongo Austin)
Deployment Strategies (Mongo Austin)
 
Deployment
DeploymentDeployment
Deployment
 
2013 london advanced-replication
2013 london advanced-replication2013 london advanced-replication
2013 london advanced-replication
 
Deployment Preparedness
Deployment Preparedness Deployment Preparedness
Deployment Preparedness
 
MongoDB at Scale
MongoDB at ScaleMongoDB at Scale
MongoDB at Scale
 
2014 05-07-fr - add dev series - session 6 - deploying your application-2
2014 05-07-fr - add dev series - session 6 - deploying your application-22014 05-07-fr - add dev series - session 6 - deploying your application-2
2014 05-07-fr - add dev series - session 6 - deploying your application-2
 
MongoDB Best Practices in AWS
MongoDB Best Practices in AWS MongoDB Best Practices in AWS
MongoDB Best Practices in AWS
 
Silicon Valley Code Camp 2015 - Advanced MongoDB - The Sequel
Silicon Valley Code Camp 2015 - Advanced MongoDB - The SequelSilicon Valley Code Camp 2015 - Advanced MongoDB - The Sequel
Silicon Valley Code Camp 2015 - Advanced MongoDB - The Sequel
 
WiredTiger In-Memory vs WiredTiger B-Tree
WiredTiger In-Memory vs WiredTiger B-TreeWiredTiger In-Memory vs WiredTiger B-Tree
WiredTiger In-Memory vs WiredTiger B-Tree
 
Scaling MongoDB
Scaling MongoDBScaling MongoDB
Scaling MongoDB
 
Backup, Restore, and Disaster Recovery
Backup, Restore, and Disaster RecoveryBackup, Restore, and Disaster Recovery
Backup, Restore, and Disaster Recovery
 
The Dirty Little Secrets They Didn’t Teach You In Pentesting Class
The Dirty Little Secrets They Didn’t Teach You In Pentesting Class The Dirty Little Secrets They Didn’t Teach You In Pentesting Class
The Dirty Little Secrets They Didn’t Teach You In Pentesting Class
 
Mongo db roma replication and sharding
Mongo db roma replication and shardingMongo db roma replication and sharding
Mongo db roma replication and sharding
 

More from MongoDB

More from MongoDB (20)

MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
 
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
 
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
 
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDBMongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
 
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
 
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
 
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 MongoDB SoCal 2020: MongoDB Atlas Jump Start MongoDB SoCal 2020: MongoDB Atlas Jump Start
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
 
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
 
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
 
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
 
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your MindsetMongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
 
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas JumpstartMongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
 
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
 
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
 
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
 
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep DiveMongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
 
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & GolangMongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
 
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
 
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

Ops Jumpstart: MongoDB Administration 101

  • 1. #MongoDBDays 5 Things you need to know about Administering MongoDB Alvin Richards Senior Director of Performance Engineering, MongoDB
  • 2. #MongoDBDays Or… A Dev and Ops "Love Story" Alvin Richards Senior Director of Performance Engineering, MongoDB
  • 3. Before we start… • I'm assuming you have at least – installed MongoDB – Have done some basic Admin • I'm not assuming you have – Been running in production for any length of time
  • 4. Dev are from Mars and Ops are from Venus… DEV OPS
  • 5. 5 Things you need to know 1. Know Thy Beast 2. Protecting data 3. Scaling Writes & Reads 4. Monitoring 5. Backing up & Restoring
  • 6. #1 Know thy beast
  • 7. Architecture • Shipped as Binaries • tarball, zip file • Packages(rpm, yum) • MSI (for Windows) • Runs a background process mongod (or mogod.exe) • Uses Memory Mapped Files
  • 8. Memory Mapped files – dude whoa • To MongoDBmemory is an infinite-ish pool • 64 TB Linux / Windows 2012 R2 / Windows 8.1 • 4 TB earlier Windows versions • MongoDB accesses memory locations in virtual memory • O/S may have to page in that data from storage • O/S may have to page out data from RAM • Physical RAM acts as a LRU cache
  • 10. Virtual Address Space 1 Collection 1 Index 1 This is your virtual memory size (mapped)
  • 11. Physical RAM Collection 1 Index 1 This is your resident memory size Virtual Address Space 1
  • 12. Collection Disk 1 Physical RAM Index 1 Virtual Address Space 1
  • 13. Collection Disk 1 Physical RAM Index 1 100 ns 10,000,000 ns = = Virtual Address Space 1
  • 14. What Memory is used for • Working Set – Active Data & Indexes in Memory • Sorting • Aggregation & Map/Reduce • Connections
  • 15. Working Set Exceeds Physical Memory
  • 16. Where can I find this info? > db.serverStatus( { workingSet: 1 } ) … "workingSet" : { "note" : "thisIsAnEstimate", "pagesInMemory" : 378, "computationTimeMicros" : 4104, "overSeconds" : 4646 },
  • 17. Where can I find this info? > mongostat … Insert query update delete getmore command flushes mapped vsize res *0 *0 *0 *0 0 1|0 0 160m 2.75g 5m *0 *0 *0 *0 0 1|0 0 160m 2.75g 5m > iostat > sar > vmstat Windows: Perfmon
  • 19. Deployment - Single Node Good • Write ahead journaling for crash protection Bad • Cannot survive loss of one node Primary – A
  • 21. Replica Set – Initialize
  • 22. Replica Set – Failure
  • 23. Replica Set – Failover
  • 24. Replica Set – Recovery
  • 25. Replica Set – Recovered
  • 26. Oops… Multiple Failures http://f1-grandprix.com/wp-content/uploads/wppa/565.jpg
  • 27. Deployment–Single Data Center Good • Automated failover • Tolerates server failures • Tolerates rack failures • Number of replicas defines failure tolerance Bad • Cannot survive loss of Data Center Primary – A Secondary – B Secondary – C
  • 28. Deployment - Active/Active Data Center US-B Data Center - US US-A EU-C EC-D ASIA-E Data Center - Europe Data Center - Asia Good • Tolerates server, rack, data center failures, network partitions Bad • Complexity but "MMS Automation to the rescue" ™
  • 29. Useful commands > rs.status() { "set" : "foo", "date" : ISODate("2014-09-08T01:29:58Z"), "myState" : 1, "members" : [ { "_id" : 0, "name" : "vero.local:31000", "health" : 1, "state" : 1, "stateStr" : "PRIMARY", "uptime" : 28,
  • 30. Useful commands > rs.printReplicationInfo() configured oplog size: 192MB log length start to end: 0secs (0hrs) oplog first event time: Sun Sep 07 2014 18:17:52 GMT-0700 (PDT) oplog last event time: Sun Sep 07 2014 18:29:52 GMT-0700 (PDT) now: Sun Sep 07 2014 18:30:49 GMT-0700 (PDT)
  • 32. Tunable Data Durability Memory Journal Secondar y Other Data Center RDBMS w=1 j=true w="majority " w=n w="myTag " Latenc y async sync Durability
  • 33. #3 Scaling Writes & Reads
  • 35. Sharding - Range distribution sh.shardCollection("test.tweets", {user: 1} , false) shard01 shard02 shard03
  • 36. Sharding - Range distribution shard01 shard02 shard03 a-i j-r s-z
  • 37. Shard Key Options • Single or Compound Key • Regular or Hashed key • Tagged
  • 38. Sharding – Auto Splits shard01 shard02 shard03 a-i ja-jz s-z k-r
  • 39. Sharding – Auto Splits shard01 shard02 shard03 a-i ja-ji s-z ji-js js-jw jz-r
  • 40. Sharding - Auto Balancing shard01 shard02 shard03 a-i ja-ji s-z ji-js js-jw jz-r js-jw jz-r
  • 41. Sharding - Goal Equilibrium shard01 shard02 shard03 a-i ja-ji s-z ji-js js-jw jz-r
  • 42. Sharding - Find by Shard Key find({user: "alvin"}) shard01 shard02 shard03 a-i ja-ji s-z ji-js js-jw jz-r
  • 43. Sharding - Find by Attribute find({email: "alvin@10gen.com"}) shard01 shard02 shard03 a-i ja-ji s-z ji-js js-jw jz-r
  • 45. Shard Key • What key to use? • Plain or Hashed? • What's the distribution & usage? • Predicate & Sorts – Use the Shard key? – Scatter Gather + Sort?
  • 46. Useful commands > sh.status() ... shards: { "_id" : "shard0000", "host" : "localhost:29001", "tags" : [ "dc-emea" ] } { "_id" : "shard0001", "host" : "localhost:29002", "tags" : [ "dc-asia" ] } { "_id" : "shard0002", "host" : "localhost:29003", "tags" : [ "dc-na" ] } databases: { "_id" : "scaleout", "partitioned" : true, "primary" : "shard0000" } scaleout.blogs shard key: { "loc" : 1 } chunks: shard0000 1 { "loc" : { "$minKey" : 1 } } -->> { "loc" : { "$maxKey" : 1 } } on : shard0000 Timestamp(1, 0)
  • 47. Useful commands // Commands to start/Stop the balancer > sh.startBalancer() > sh.stopBalancer() // Disable balancing for a specific collection > sh.disableBalancing("students.grades") // Runt the balancer during a specific time window > db.settings.update({ _id : "balancer" }, { $set : { activeWindow : { start : "<start-time>", stop : "<stop-time>" } } }, true )
  • 49. Immediate vs. Eventual Consistency • Do you want to read your own writes? – Use Sharding to Scale Reads • Are you tolerant to read older versions of data? – May read from Secondary's
  • 51. Immediate Consistency Thread #1 Primary Insert Read Update Read v1 ✔ v2 ✔
  • 52. Eventual Consistency Thread #1 Primary Secondary Insert Read v1 Thread #2 ✖ v1 v1 does not exist reads v1 Update Read v2 ✖ v2
  • 53. Eventual Consistency with a Write Concern Thread #1 Primary Secondary Insert (w=2) Read v1 Thread #2 ✖ v1 does not exist v1 reads v1 ✔
  • 55. Pick your tool dejour • Plugins for – Cacti, Zabix, Munin, NewRelic…. • MongoDB Monitoring (MMS) – mms.mongodb.com – Focused on MongoDB cluster well being
  • 56. MMS
  • 57. KPIs you care about • MongoDB – MongoDB ops/sec – Read/Write queues – Index Misses – Locked % – Flush times – Replication Lag
  • 58. KPIs you care about • Storage – IOPS – Size – Data & Loading Patterns • Memory – Working Set • CPU – Speed – Cores • Network – Latency – Throughput
  • 59. Example MongoDB ops/sec Page Faults / Sec
  • 60. #5 Backup & Restore
  • 61. Options • mongodump / mongorestore • File system snaphot / rsync • MMS Backup – Automated Cluster Backup / Restore – Snapshots – Point in Time recovery – OpLog based
  • 62. MMS Backup & Restore
  • 63. Other talks today • 10.25 – Running MongoDB with confidence with MMS • 12.45 –MongoDB Sharding • 1.05 – Securing Your MongoDB Deployment • 4.10 – Diagnostics and Debugging
  • 64. Get MongoDB Certified • 20% off our October exam with the code • MongoDBSeattle20 • TODAY ONLY • university.mongodb.com
  • 65. A happy ever after? Dev Ops
  • 66. #MongoDBDays Thank You Alvin Richards alvin@mongodb.com / @jonnyeight Senior Director of Performance Engineering, MongoDB

Editor's Notes

  1. Can map this back to the linking versus embedding question. For an embedded object, the worst case is page fault(s) to read the object, but on disk this will be a seek followed by a sequential read For a linked objects, the worst case is a page fault for each, which is a disk seek for each linked object
  2. High Availability – Ensure application availability during many types of failures Disaster Recovery – Address the RTO and RPO goals for business continuity Maintenance – Perform upgrades and other maintenance operations with no application downtime Secondaries can be used for a variety of applications – failover, hot backup, rolling upgrades, data locality and privacy and workload isolation
  3. Initialize -> Election Primary + data replication from primary to secondary
  4. Primary down/network failure Automatic election of new primary if majority exists
  5. New primary elected Replication established from new primary
  6. Down node comes up Rejoins sets Recovery and then secondary
  7. Add icon/image for resources; use those images/icons for the rest of the slides