Science of mongodb

2,162 views
2,043 views

Published on

Published in: Technology, Education
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,162
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
20
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • A system is consistent if an update is applied to all nodes at the same time. This pretty much means that standard database replication is not strongly consistent. Any system using a replica for reads runs the risk of using stale data.\n
  • A system in available if all clients can access some form of the data even during a partial failure.\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Since we need to maintain partition tolerance, what are we willing to sacrifice?\n
  • In the case of choosing consistency over availability, the cluster will maintain integrity by refusing some requests. It may shut down, refuse writes, or refuse reads/writes for the chunks of data that are unavailable. (hint: This is what Mongo does)\n
  • If a cluster chooses availability over consistency during a failure, it will still respond to all requests. Stale reads and conflicting writes are often the outcome of this.\n
  • \n
  • This means during times of failure, we are sacrificing availability\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Mongo handles this in a pretty simple way, avoid complex transactions.\n
  • \n
  • Once again, without complex transactions, this really isn’t a problem\n
  • \n
  • \n
  • \n
  • \n
  • Science of mongodb

    1. 1. The Science ofMongoDB @ethangunderson MongoDC 2011
    2. 2. Hiring
    3. 3. 1)CAP?2)What does MongoDB do about it?3)Compare and Contrast4)ACID?5)How it relates to MongoDB
    4. 4. Questions?Comments?Shout Out!
    5. 5. CAP Theorem
    6. 6. Eric Brewer
    7. 7. ConsistencyAvailabilityPartition Tolerance
    8. 8. Consistency All clients have thesame view of the data
    9. 9. AvailabilityAll clients have access to all data
    10. 10. Partition Tolerance The system’s properties hold true in the case of partitions
    11. 11. Pick Two
    12. 12. CAThis is not a real option.
    13. 13. You Canʼt SacrificePartition Tolerance http://codahale.com/you- cant-sacrifice-partition- tolerance/
    14. 14. When a failure happens, what am I sacrificing? Consistency or Availability?
    15. 15. CP The system sacrifices availability in order tomaintain data consistency
    16. 16. AP The system sacrificesconsistency to ensure the most uptime as possible
    17. 17. What is Mongo?
    18. 18. CPSince, by default, Mongo routes all requests to a master, it is strongly consistent
    19. 19. MasterSlave Slave
    20. 20. MasterSlave Slave
    21. 21. MasterSlave Slave
    22. 22. Replica Set Replica Set
    23. 23. Replica Set Replica Set
    24. 24. Optionally AP
    25. 25. Master Client:slaveOK Slave Slave
    26. 26. (Amazon Dynamo)
    27. 27. AP As long as one node isup, the cluster can service read/write requests
    28. 28. foo: 12foo: nil foo: 35
    29. 29. ACID
    30. 30. AtomicityAll transactions are “all or nothing”
    31. 31. Consistency All transactions takethe database from onevalid state to the next
    32. 32. Isolation Transactions cannotaccess data modified in another uncompleted transaction
    33. 33. DurabilityThe ability to recovercommitted transaction updates
    34. 34. Consistency !=Consistency
    35. 35. Thanks!

    ×