This presentation covers two important topics for scalable mongodb deployments. First, we will discus how MongoDB stores data so you can figure out how much RAM you need in each of your servers. Second, we'll look at replica sets and how to design a highly available topology for your replica set.
2. Agenda Sizing Machines Understanding working set Sizing RAM Sizing Disk Configuring Replica Sets Understanding failover Avoiding single points of failure Minimizing recovery time
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
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
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
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