Technical overview of three of the most representative KeyValue Stores: Cassandra, Redis and CouchDB. Focused on Ruby and Ruby on Rails developement, this talk shows how to solve common problems, the most popular libraries, benchmarking and the best use case for each one of them.
This talk was part of the Conferencia Rails 2009, Madrid, Spain.
http://app.conferenciarails.org/talks/43-key-value-stores-conviertete-en-un-jedi-master
17. Redis
•Rocks
•Speed, in memory dataset
•Asynch non-blocking persistence
•Non-blocking replication
•Data structures with atomic operations
•Ease of use and deployment
•Sucks
•Sharding (client-side only at the moment)
•Datasets > RAM
•Very frequent code updates (?)
20. Cassandra
Structure Storage System over P2P network
•Developed at Facebook
•Java
•Dynamo: partition and
replication
•Bigtable: Log-structured
ColumnFamily data model
22. Cassandra
•Rocks
•High Availability
•Incremental Scalability
•Minimal Administration
•No Single Point of Failure
•Sucks
•Thrift API (...not so bad)
•Change Schema, restart server
•The Logo
25. Cassandra
•Class mapping
• ColumnFamily :Blog, :Post
•ID generation
•UUID.new(Time.now)
•Relationships
•Use ColumnFamily :PostsforUser to
hold all posts that belong to a user
26. Cassandra
•Index sorting
•Columns within a ColumnFamily are stored in
sorted order. Keys are also sorted (if
OrderPreservingPartitioner)
•Pagination
•for keys get_range (start, finish, count)
•for columns get_slice (start, finish, count)
•Data filtering
•Use get_range/get_slice and play around with
start/finish
29. CouchDB
•Type attribute in each document
•CouchDB automatic ID generation
•Related document IDs in the
attributes
•Views with complex keys
•Special attributes for view functions
36. Conclusions
•Complementary to relational solutions
•Each K/V address a different problem
•Best use case:
•CouchDB: distributed/scalable
Javascript-only app (no backend)
•Cassandra: big amount of writes, no
SPOF
•Redis: datasets < RAM, lookups,
cache, buffers
37. Credits
•All sponsored products, company names, brand names,
trademarks and logos are the property of their respective
owners.
•Alfa Romeo Giulietta: http://www.flickr.com/photos/
mauboi/3296469097/
•Pizza: http://reportingfrombelgium.wordpress.com/2009/
05/20/belgian-summer-holidays/
•Sammy: http://www.yuddy.com/celebrity/Sammy-Davis-
Jr/bio
•Everything else is from teh internets and is free.