SlideShare ist ein Scribd-Unternehmen logo
1 von 46
MongoDB deployment tipsJared Rosoff - @forjared
Agenda Sizing Machines Understanding working set  Sizing RAM  Sizing Disk  Configuring Replica Sets Understanding failover  Avoiding single points of failure  Minimizing recovery time
Overview Secondary Secondary Secondary Config Config Config Router Router Shard 1 Shard 2 Shard 3 Primary Primary Primary Secondary Secondary Secondary
Servers and Hardware Secondary Secondary Secondary Config Config Config Router Router Shard 1 Shard 2 Shard 3 Primary Primary Primary Secondary Secondary Secondary
Sizing ram and disk
Collection 1 Index 1
Collection 1 Virtual Address Space 1 Index 1
Collection 1 Virtual Address Space 1 This is your virtual memory size (mapped)  Index 1
Collection 1 Virtual Address Space 1 Physical RAM Index 1
Collection 1 Virtual Address Space 1 Physical RAM Index 1 This is your resident memory size
Disk Collection 1 Virtual Address Space 1 Physical RAM Index 1
Disk Collection 1 Virtual Address Space 1 Physical RAM Index 1 Virtual Address Space 2
Disk Collection 1 Virtual Address Space 1 Physical RAM Index 1 100 ns = 10,000 ns =
Disk configurations Single Disk ~200 seeks / second
Disk configurations Single Disk RAID 0 ~200 seeks / second ~200 seeks / second ~200 seeks / second ~200 seeks / second
Disk configurations Single Disk RAID 0 ~200 seeks / second RAID 10 ~200 seeks / second ~200 seeks / second ~200 seeks / second ~400 seeks / second ~400 seeks / second ~400 seeks / second
SSDs ??  Seek time of 0.1ms vs 5ms  (200 seeks / sec => 10000 seeks / sec) But expensive
Tips for sizing hardware Know how important page faults are If you want low latency, avoid page faults Size memory appropriately  To avoid page faults, fit everything in RAM Collection Data + Index Data Provision disk appropriately RAID10 is recommended SSD’s are fast, if you can afford them
Replica Sets Secondary Secondary Secondary Config Config Config Router Router Shard 1 Shard 2 Shard 3 Primary Primary Primary Secondary Secondary Secondary
Understanding automatic failover
Primary Election As long as a partition can see a majority (>50%) of the cluster, then it will elect a primary.  Secondary Primary Secondary
Simple Failure 66% of cluster visible. Primary is elected Primary Failed Node Secondary
Simple Failure 33% of cluster visible.  Read only mode.  Failed Node Failed Node Secondary
Network Partition Secondary Primary Secondary
Network Partition 66% of cluster visible. Primary is elected Secondary Failed Node Primary Primary Secondary Secondary
Secondary Network Partition Primary Failed Node Secondary Secondary Failed Node 33% of cluster visible.  Read only mode.
Even Cluster Size Secondary Primary Secondary Secondary
Even Cluster Size 50% of cluster visible.  Read only mode.  Secondary Failed Node Primary Secondary Failed Node Secondary Secondary Secondary
Even Cluster Size Secondary Failed Node Primary Secondary Failed Node Secondary Secondary Secondary 50% of cluster visible.  Read only mode.
Avoiding single points of failure
Avoid Single points of failure
Avoid Single points of failure Secondary Primary Secondary Top of rack switch Rack falls over
Better Secondary Primary Secondary Loss of internet Building burns down
Better yet San Francisco Secondary Primary Dallas Secondary
Priorities San Francisco Priority 1 Priority 1 Secondary Priority 0 Primary Dallas Secondary Disaster recover data center. Will never become primary automatically.
Even Better San Francisco New York Secondary Primary Dallas Secondary
Fast recovery
2 Replicas + Arbiter?? Arbiter Is this a good idea?  Primary Secondary
2 Replicas + Arbiter?? 1 Arbiter Primary Secondary
2 Replicas + Arbiter?? 1 2 Arbiter Arbiter Primary Primary Secondary Secondary
2 Replicas + Arbiter?? 3 1 2 Full Sync Arbiter Arbiter Arbiter Primary Primary Primary Secondary Secondary Secondary Secondary Uh oh. Full Sync is going to use a lot of resources on the primary. So I may have downtime or degraded performance
With 3 replicas 1 Primary Secondary Secondary
With 3 replicas 1 2 Primary Primary Secondary Secondary Secondary Secondary
With 3 replicas 3 1 2 Primary Primary Primary Full Sync Secondary Secondary Secondary Secondary Secondary Secondary Secondary Sync can happen from secondary, which will not impact traffic on Primary.
Tips for choosing replica set topology Avoid single points of failure  Separate racks Separate data centers Avoid long recovery downtime Use journaling  Use 3+ replicas Keep your actives close  Use priority to control where failovers happen
Summary Sizing a machine  Know your working set size  Size RAM appropriately  Provision sufficient disks  Designing a replica set  Know how failover happens  Design for failure  Design for fast recover

Weitere ähnliche Inhalte

Ähnlich wie MongoDB Deployment Tips

MongoDB Best Practices in AWS
MongoDB Best Practices in AWS MongoDB Best Practices in AWS
MongoDB Best Practices in AWS
Chris Harris
 
Top 5 Mistakes When Writing Spark Applications by Mark Grover and Ted Malaska
Top 5 Mistakes When Writing Spark Applications by Mark Grover and Ted MalaskaTop 5 Mistakes When Writing Spark Applications by Mark Grover and Ted Malaska
Top 5 Mistakes When Writing Spark Applications by Mark Grover and Ted Malaska
Spark Summit
 
OOUG - Oracle Performance Tuning with AAS
OOUG - Oracle Performance Tuning with AASOOUG - Oracle Performance Tuning with AAS
OOUG - Oracle Performance Tuning with AAS
Kyle Hailey
 

Ähnlich wie MongoDB Deployment Tips (20)

MongoDB Best Practices in AWS
MongoDB Best Practices in AWS MongoDB Best Practices in AWS
MongoDB Best Practices in AWS
 
The overview of raid10
The overview of raid10The overview of raid10
The overview of raid10
 
rac_for_beginners_ppt.pdf
rac_for_beginners_ppt.pdfrac_for_beginners_ppt.pdf
rac_for_beginners_ppt.pdf
 
MySQL Monitoring 101
MySQL Monitoring 101MySQL Monitoring 101
MySQL Monitoring 101
 
The care and feeding of a MySQL database
The care and feeding of a MySQL databaseThe care and feeding of a MySQL database
The care and feeding of a MySQL database
 
Raid
Raid Raid
Raid
 
Top 5 Mistakes When Writing Spark Applications
Top 5 Mistakes When Writing Spark ApplicationsTop 5 Mistakes When Writing Spark Applications
Top 5 Mistakes When Writing Spark Applications
 
Top 5 mistakes when writing Spark applications
Top 5 mistakes when writing Spark applicationsTop 5 mistakes when writing Spark applications
Top 5 mistakes when writing Spark applications
 
Top 5 Mistakes to Avoid When Writing Apache Spark Applications
Top 5 Mistakes to Avoid When Writing Apache Spark ApplicationsTop 5 Mistakes to Avoid When Writing Apache Spark Applications
Top 5 Mistakes to Avoid When Writing Apache Spark Applications
 
Top 5 Mistakes When Writing Spark Applications by Mark Grover and Ted Malaska
Top 5 Mistakes When Writing Spark Applications by Mark Grover and Ted MalaskaTop 5 Mistakes When Writing Spark Applications by Mark Grover and Ted Malaska
Top 5 Mistakes When Writing Spark Applications by Mark Grover and Ted Malaska
 
Top 5 mistakes when writing Spark applications
Top 5 mistakes when writing Spark applicationsTop 5 mistakes when writing Spark applications
Top 5 mistakes when writing Spark applications
 
PhpTek Ten Things to do to make your MySQL servers Happier and Healthier
PhpTek Ten Things to do to make your MySQL servers Happier and HealthierPhpTek Ten Things to do to make your MySQL servers Happier and Healthier
PhpTek Ten Things to do to make your MySQL servers Happier and Healthier
 
Top 5 mistakes when writing Spark applications
Top 5 mistakes when writing Spark applicationsTop 5 mistakes when writing Spark applications
Top 5 mistakes when writing Spark applications
 
Congratsyourthedbatoo
CongratsyourthedbatooCongratsyourthedbatoo
Congratsyourthedbatoo
 
Replication, Durability, and Disaster Recovery
Replication, Durability, and Disaster RecoveryReplication, Durability, and Disaster Recovery
Replication, Durability, and Disaster Recovery
 
Performance and predictability (1)
Performance and predictability (1)Performance and predictability (1)
Performance and predictability (1)
 
Performance and Predictability - Richard Warburton
Performance and Predictability - Richard WarburtonPerformance and Predictability - Richard Warburton
Performance and Predictability - Richard Warburton
 
Losing Data in a Safe Way – Advanced Replication Strategies in Apache Hadoop ...
Losing Data in a Safe Way – Advanced Replication Strategies in Apache Hadoop ...Losing Data in a Safe Way – Advanced Replication Strategies in Apache Hadoop ...
Losing Data in a Safe Way – Advanced Replication Strategies in Apache Hadoop ...
 
OOUG - Oracle Performance Tuning with AAS
OOUG - Oracle Performance Tuning with AASOOUG - Oracle Performance Tuning with AAS
OOUG - Oracle Performance Tuning with AAS
 
Apache SolrCloud
Apache SolrCloudApache SolrCloud
Apache SolrCloud
 

Mehr von Jared Rosoff (8)

MongoDB Advanced Schema Design - Inboxes
MongoDB Advanced Schema Design - InboxesMongoDB Advanced Schema Design - Inboxes
MongoDB Advanced Schema Design - Inboxes
 
Mongosv 2011 - Sharding
Mongosv 2011 - ShardingMongosv 2011 - Sharding
Mongosv 2011 - Sharding
 
Mongosv 2011 - Replication
Mongosv 2011 - ReplicationMongosv 2011 - Replication
Mongosv 2011 - Replication
 
Scaling with mongo db - SF Mongo User Group 7-19-2011
Scaling with mongo db - SF Mongo User Group 7-19-2011Scaling with mongo db - SF Mongo User Group 7-19-2011
Scaling with mongo db - SF Mongo User Group 7-19-2011
 
MongoDB on EC2 and EBS
MongoDB on EC2 and EBSMongoDB on EC2 and EBS
MongoDB on EC2 and EBS
 
Indexing & query optimization
Indexing & query optimizationIndexing & query optimization
Indexing & query optimization
 
Web performance meetup bos 11 18-2010
Web performance meetup bos 11 18-2010Web performance meetup bos 11 18-2010
Web performance meetup bos 11 18-2010
 
Scalable Event Analytics with MongoDB & Ruby on Rails
Scalable Event Analytics with MongoDB & Ruby on RailsScalable Event Analytics with MongoDB & Ruby on Rails
Scalable Event Analytics with MongoDB & Ruby on Rails
 

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
+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@
 

Kürzlich hochgeladen (20)

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 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
 
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...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
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
 
+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...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
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
 
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
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
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...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

MongoDB Deployment Tips

  • 1. MongoDB deployment tipsJared Rosoff - @forjared
  • 2. Agenda Sizing Machines Understanding working set Sizing RAM Sizing Disk Configuring Replica Sets Understanding failover Avoiding single points of failure Minimizing recovery time
  • 3. Overview Secondary Secondary Secondary Config Config Config Router Router Shard 1 Shard 2 Shard 3 Primary Primary Primary Secondary Secondary Secondary
  • 4. Servers and Hardware Secondary Secondary Secondary Config Config Config Router Router Shard 1 Shard 2 Shard 3 Primary Primary Primary Secondary Secondary Secondary
  • 7. Collection 1 Virtual Address Space 1 Index 1
  • 8. Collection 1 Virtual Address Space 1 This is your virtual memory size (mapped) Index 1
  • 9. Collection 1 Virtual Address Space 1 Physical RAM Index 1
  • 10. Collection 1 Virtual Address Space 1 Physical RAM Index 1 This is your resident memory size
  • 11. Disk Collection 1 Virtual Address Space 1 Physical RAM Index 1
  • 12. Disk Collection 1 Virtual Address Space 1 Physical RAM Index 1 Virtual Address Space 2
  • 13. Disk Collection 1 Virtual Address Space 1 Physical RAM Index 1 100 ns = 10,000 ns =
  • 14. Disk configurations Single Disk ~200 seeks / second
  • 15. Disk configurations Single Disk RAID 0 ~200 seeks / second ~200 seeks / second ~200 seeks / second ~200 seeks / second
  • 16. Disk configurations Single Disk RAID 0 ~200 seeks / second RAID 10 ~200 seeks / second ~200 seeks / second ~200 seeks / second ~400 seeks / second ~400 seeks / second ~400 seeks / second
  • 17. SSDs ?? Seek time of 0.1ms vs 5ms (200 seeks / sec => 10000 seeks / sec) But expensive
  • 18. Tips for sizing hardware Know how important page faults are If you want low latency, avoid page faults Size memory appropriately To avoid page faults, fit everything in RAM Collection Data + Index Data Provision disk appropriately RAID10 is recommended SSD’s are fast, if you can afford them
  • 19. Replica Sets Secondary Secondary Secondary Config Config Config Router Router Shard 1 Shard 2 Shard 3 Primary Primary Primary Secondary Secondary Secondary
  • 21. Primary Election As long as a partition can see a majority (>50%) of the cluster, then it will elect a primary. Secondary Primary Secondary
  • 22. Simple Failure 66% of cluster visible. Primary is elected Primary Failed Node Secondary
  • 23. Simple Failure 33% of cluster visible. Read only mode. Failed Node Failed Node Secondary
  • 24. Network Partition Secondary Primary Secondary
  • 25. Network Partition 66% of cluster visible. Primary is elected Secondary Failed Node Primary Primary Secondary Secondary
  • 26. Secondary Network Partition Primary Failed Node Secondary Secondary Failed Node 33% of cluster visible. Read only mode.
  • 27. Even Cluster Size Secondary Primary Secondary Secondary
  • 28. Even Cluster Size 50% of cluster visible. Read only mode. Secondary Failed Node Primary Secondary Failed Node Secondary Secondary Secondary
  • 29. Even Cluster Size Secondary Failed Node Primary Secondary Failed Node Secondary Secondary Secondary 50% of cluster visible. Read only mode.
  • 31. Avoid Single points of failure
  • 32. Avoid Single points of failure Secondary Primary Secondary Top of rack switch Rack falls over
  • 33. Better Secondary Primary Secondary Loss of internet Building burns down
  • 34. Better yet San Francisco Secondary Primary Dallas Secondary
  • 35. Priorities San Francisco Priority 1 Priority 1 Secondary Priority 0 Primary Dallas Secondary Disaster recover data center. Will never become primary automatically.
  • 36. Even Better San Francisco New York Secondary Primary Dallas Secondary
  • 38. 2 Replicas + Arbiter?? Arbiter Is this a good idea? Primary Secondary
  • 39. 2 Replicas + Arbiter?? 1 Arbiter Primary Secondary
  • 40. 2 Replicas + Arbiter?? 1 2 Arbiter Arbiter Primary Primary Secondary Secondary
  • 41. 2 Replicas + Arbiter?? 3 1 2 Full Sync Arbiter Arbiter Arbiter Primary Primary Primary Secondary Secondary Secondary Secondary Uh oh. Full Sync is going to use a lot of resources on the primary. So I may have downtime or degraded performance
  • 42. With 3 replicas 1 Primary Secondary Secondary
  • 43. With 3 replicas 1 2 Primary Primary Secondary Secondary Secondary Secondary
  • 44. With 3 replicas 3 1 2 Primary Primary Primary Full Sync Secondary Secondary Secondary Secondary Secondary Secondary Secondary Sync can happen from secondary, which will not impact traffic on Primary.
  • 45. Tips for choosing replica set topology Avoid single points of failure Separate racks Separate data centers Avoid long recovery downtime Use journaling Use 3+ replicas Keep your actives close Use priority to control where failovers happen
  • 46. Summary Sizing a machine Know your working set size Size RAM appropriately Provision sufficient disks Designing a replica set Know how failover happens Design for failure Design for fast recover