8. Dynamo
• Simple Key/Value store
• No master node
• Write to any (many) nodes
• Read from one or more nodes (balance
speed vs. consistency)
• Read repair
12. Tokyo Cabinet + Tyrant
• Key/value store with focus on speed
• Some more advanced queries
• Sorting, range or prefix matching
• Multiple storage engines
• Hash, B-Tree, Fixed length and Table
13. • A lot in common with MongoDB:
• Document-oriented
• Schema-free
• JSON-style documents
14. • Differences
• MVCC based
• Replication as path to scalability
• Query through predefined views
• ACID
• REST
15. • Focus on performance
• Rich dynamic queries
• Secondary indexes
• Replication / failover
• Auto-sharding
• Many platforms / languages supported
16.
17. Good at
• The web
• Caching
• High volume / low value
• Scalability
18. Less good at
• Highly transactional
• Ad-hoc business intelligence
• Problems that require SQL
19. PyMongo
• Python driver for MongoDB
• Pure Python, with optional C extension
• Installation (setuptools):
easy_install pymongo
20. Document
• Unit of storage (think row)
• Just a dictionary
• Can store many Python types:
• None, bool, int, float, string / unicode,
dict, datetime.datetime, compiled re
• Some special types:
• SON, Binary, ObjectId, DBRef
26. New post
post = {“author”: “mike”,
“date”: datetime.datetime.utcnow(),
“text”: “my blog post...”,
“tags”: [“mongodb”, “python”]}
post_id = db.posts.save(post)
27. Embedding a comment
c = {“author”: “eliot”,
“date”: datetime.datetime.utcnow(),
“text”: “great post!”}
db.posts.update({“_id”: post_id},
{“$push”: {“comments”: c}})
28. Last 10 posts
query = db.posts.find()
.sort(“date”, DESCENDING)
.limit(10)
for post in query:
print post[“text”]