Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Multi Data Center Strategies

11,412 views

Published on

Strategies for multi-data center deployment. Diving into the details of deploying of MongoDB across multiple data centers.

Covers the advantages of a multi data center deployment for read/write locality, the various deployment strategies, and disaster preparedness and recovery.

In addition, we’ll look at the MongoDB roadmap and planned enhancements around data center awareness.


This presentation was given at MongoNYC 2012. The animations didn’t survive the transformation to the web, so not all the meaning carries over perfectly.

Published in: Technology, Art & Photos
  • Be the first to comment

Multi Data Center Strategies

  1. 1. Data CenterAwareness
  2. 2. @spf13 AKASteve Francia15+ years buildingthe internet Father, husband, skateboarderChief Solutions Architect @responsible for drivers,integrations, web & docs
  3. 3. IntroductionThe most importantfeature ever...When you need it
  4. 4. MultipleData CentersLet’s describe our scenario
  5. 5. We will BuildA Social Network
  6. 6. A Global Social NetworkFor simplicity.. let’s focus on 3 locations
  7. 7. ChallengesData ConsistencyMaintain good userexperienceScaling
  8. 8. Single Database location DB
  9. 9. Single Database location DB Fast Slo
  10. 10. Single Write location Write DB Read DB Read DB
  11. 11. Single Write location Write DB Read DB Read DB
  12. 12. Single Write location Write DB Read DB Read DB
  13. 13. Single Write location Write DB Read DB Read DB
  14. 14. We Need MoreData is localized (for themost part)Users interact local toregion (mostly)
  15. 15. GoalsRoute data locallyMinimize global failuresRemote data low latencyMinimize remote dataaccess
  16. 16. MongoDB
  17. 17. Local WriteWrite DB Read DB ReplicaDB Read Set
  18. 18. Local Write Write DB Read DB Read DB Replica Set
  19. 19. 3 locations 3 Replica SetsWrite DB Write DB Write DB Read DB Read DB Read DB Read DB Read DB Read DBReplica Set Replica Set Replica Set
  20. 20. 3 locations 3 Replica SetsWrite DB Write DB Write DB Read DB Read DB Read DB Read DB Read DB Read DBReplica Set Replica Set Replica Set
  21. 21. 3 locations 3 Replica Sets Read DB Write DB Read DBWrite DB Read DB Read DB Replica Set Replica Set Replica Set Read DB Read DB Write DB
  22. 22. 3 locations 3 Replica Sets Read DB Write DB Read DBWrite DB Read DB Read DB Replica Set Replica Set Replica Set Read DB Read DB Write DB
  23. 23. 3 locations 3 Replica Sets Read DB Write DB Read DBWrite DB Read DB Read DB Replica Set Replica Set Replica Set Read DB Read DB Write DB
  24. 24. 3 locations 3 Replica Sets Read DB Write DB Read DBWrite DB Read DB Read DB Replica Set Replica Set Replica Set Read DB Read DB Write DB
  25. 25. Local WritesLocal REads (w/delays) Write DB Write DB Read DB Read DB Read DB Read DB Write DB Read DB Read DB
  26. 26. Local WritesLocal REads (w/delays) Write DB Write DB Read DB Read DB Read DB Read DB Write DB Read DB Read DB
  27. 27. Local WritesLocal REads (w/delays) Write DB Write DB Read DB Read DB Read DB Read DB Write DB Read DB Read DB
  28. 28. Local WritesLocal REads (w/delays) Write DB Write DB Read DB Read DB Read DB Read DB Write DB Read DB Read DB
  29. 29. Write Concern
  30. 30. Write Concern &If a write requires areturn tripWhat the return trip shoulddepend on
  31. 31. Write Concernw:the number of servers to replicate to.wtimeout:timeout in ms waiting for replication.j:wait for journal synctags:ensure replication to certain tagged nodes
  32. 32. Write ConcernMongo mongo = new Mongo( new MongoURI("mongodb://127.0.0.1:27017,127.0.0.1:27018"));mongo.setWriteConcern( new WriteConcern(2, 1000));
  33. 33. Write ConcernMongo mongo = new Mongo( new MongoURI("mongodb://127.0.0.1:27017,127.0.0.1:27018"));DBCollection users =mongo.getDB(“myapp”).getCollection(“users”);users.insert( new DBObject("name", "Kyle"), new WriteConcern(2, 1000))
  34. 34. GoalsRoute data locallyMinimize global failuresRemote data low latencyMinimize remote dataaccess
  35. 35. GoalsRoute data locallyMinimize global failuresRemote data low latencyMinimize remote dataaccess
  36. 36. GoalsRoute data locallyMinimize global failuresRemote data low latencyMinimize remote dataaccess
  37. 37. GoalsRoute data locallyMinimize global failuresRemote data low latencyMinimize remote dataaccess
  38. 38. GoalsRoute data locallyMinimize global failuresRemote data low latencyMinimize remote dataaccess
  39. 39. IssuesDoesn’t work withShardingCan’t control which nodeto read fromApp needs to be aware(at some level)
  40. 40. MongoDB
  41. 41. Upcoming FeaturesGeoAware ShardingRead Preferences
  42. 42. Geo-Aware shardingAdding second dimensionto shard keySecond range can beused for locality awaresharding
  43. 43. Read Preferences Read from: Primary Secondary Primary Only Secondary Only Nearestsecondary queryingrouted to specific tags
  44. 44. Scenarios
  45. 45. Scenarios1. Social Network2. Analysis3. Establishing Auth Key4. Administration
  46. 46. Social Network Write DB Write DB Read DBRead DB Read DBRead DB Write DB Read DB Read DB
  47. 47. Social Network Write DB Write DB Read DBRead DB Read DBRead DB Write DB Read DB Read DB
  48. 48. Social Network Write DB Write DB Read DBRead DB Read DBRead DB Write DB Read DB Read DB
  49. 49. Social Network Write DB Write DB Read DBRead DB Read DBRead DB Write DB Read DB Read DB
  50. 50. Analysis Write DB Write DB Read DBRead DB Read DBRead DB Write DB Read DB Read DB
  51. 51. Analysis Write DB Write DB Read DBRead DB Read DBRead DB Write DB Read DB Read DB
  52. 52. Analysis Write DB Write DB Read DBRead DB Read DBRead DB Write DB ReadPref : Read DB Read DB PrimaryOnly
  53. 53. Analysis Write DB Write DB Read DBRead DB Read DBRead DB Write DB ReadPref : Read DB Read DB PrimaryOnly
  54. 54. Auth Keys Write DB Write DB Read DBRead DB Read DBRead DB Write DB Read DB Read DB
  55. 55. Auth Keys Write DB Write DB Read DBRead DB Read DBRead DB Write DB Read DB Read DB
  56. 56. Auth Keys Write DB Write DB Read DBRead DB Read DBRead DB Write DB Read DB Read DB
  57. 57. Auth Keys Write DB Write DB Read DBRead DB Read DBRead DB Write DB Read DB Read DB WriteConcern w : all
  58. 58. Auth Keys Write DB Write DB Read DBRead DB Read DBRead DB Write DB Read DB Read DB WriteConcern w : all
  59. 59. Administration Write DB Write DB Read DBRead DB Read DBRead DB Write DB Read DB Read DB
  60. 60. Administration Write DB Write DB Read DBRead DB Read DBRead DB Write DB Read DB Read DB
  61. 61. Administration Write DB Write DB Read DBRead DB Read DBRead DB Write DB ReadPref : Read DB Read DB PrimaryOnly
  62. 62. Administration Write DB Write DB Read DBRead DB Read DBRead DB Write DB ReadPref : Read DB Read DB PrimaryOnly WriteConcern w : all
  63. 63. Administration Write DB Write DB Read DBRead DB Read DBRead DB Write DB ReadPref : Read DB Read DB PrimaryOnly WriteConcern w : all
  64. 64. Administration Write DB Write DB Read DBRead DB Read DBRead DB Write DB ReadPref : Read DB Read DB PrimaryOnly WriteConcern w : all
  65. 65. ConclusionMongoDBOpen source enterprisefeatures for when youneed them
  66. 66. http://spf13.com http://github.com/s @spf13Questions? download at mongodb.org We’re hiring!! Contact us at jobs@10gen.com

×