SlideShare a Scribd company logo
Riak and Ruby
                            Grant Schofield
                          Developer Advocate
                        Basho Technologies, Inc.




basho
Friday, July 9, 2010
Grant Schofield
                        (@schofield)


                                basho

basho
Friday, July 9, 2010
NoSQL
                       •Web 2.0, Cloud, Enterprise???
                       •Useful Reference Point
                       •Not AntiSQL
                       •Schemaless (Mostly)
                       •Diverse
                       •Thoughtful Data (Not just a NoSQL

basho
Friday, July 9, 2010
NoSQL Includes...
                       •Key Value Stores
                       •Document Databases
                       •Graphing Databases
                       •Column Databases
                       •Schemaless MySQL

basho
Friday, July 9, 2010
Prevalent Now
                       •Memcache???
                       •Session Data
                       •Caching Data
                       •Complements Traditional RDBMS
                       •Not The Magical Unicorn, but Pony
                         Perhaps


basho
Friday, July 9, 2010
Riak
                       •Open Source
                       •Erlang
                       •Dynamo and CAP Theorem Influenced
                       •Advanced Key Value Store
                       •Web Shaped
                       •Distributed by Nature
                       •Ops Obsessed
                       •A Platform
basho
Friday, July 9, 2010
Dynamo Paper
                       •Key Value Store Built By Amazon for
                         Core Services

                       •Sacrifice Availability for Consistency
                       •Consistent Hashing
                       •Merkle Trees
                       •Vector Clocks
                       •Eventually Consistent
basho
Friday, July 9, 2010
CAP Theorem
                             Consistency, Availability,
                               Partition Tolerance
                       •Dr. Eric Brewer
                       •At a Given Point You Get Two of the
                         Three

                       •Riak is Tunable
                       •Eventual Consistency - Not an Excuse to
                         Lose Data


basho
Friday, July 9, 2010
Advanced Key
                              Value Store?
                       •Not Just PUT and GET Key/Values
                       •Multiple Interfaces
                       •Links
                       •Document Like
                       •Pluggable Backend
                       •Map/Reduce
                       •Distributed
basho
Friday, July 9, 2010
Web Shaped
                       •Biggest Distributed System Ever
                       •Works Like the Web
                       •Links
                       •Talks HTTP Restfully
                       •Load Balances Just Like Web Stuff

basho
Friday, July 9, 2010
Fundamentally
                             Distributed
                       •Built From The Start
                       •Masterless
                       •Homogenous
                       •Consistent Hashing
                       •Scales Horizontally
                       •Fault Tolerant (Hinted Handoff)
basho
Friday, July 9, 2010
Consistent Hashing
                                             node 0
                                             node 1
                                   2160/4
                                             node 2
                                             node 3

                                 hash(<<"beer">>,<<"dns">>)

                        2160/2
basho
Friday, July 9, 2010
N, R, and W
                       •N = Number of Replicas
                       •R = Number of Replicas Needed for a
                         Read

                       •W = Number of Replicas Needed for a
                         Write

                       •DW = Number of Replicas Needed for a
                         Durable Write

                       •N Configurable Per Bucket
                       •R and W Configurable Per Request
basho
Friday, July 9, 2010
R Value
                                   get(<<"beer">>,<<"dnr">>,
                                             R=2)

                       (N=3)
                                                  {ok, Object}




                               X




basho
Friday, July 9, 2010
W Value
                                   put(<<"beer">>,<<"dnr">>,
                                             W=2)

                       (N=3)
                                                  ok




                               X




basho
Friday, July 9, 2010
N=10, R/W = 2
                                                get/put("beer", "dnr",
                                                        R/W=2)
                               (N=10)

                                                              {ok, Object}




            X                               X
                 X
                       X                X
                           X   X    X




basho
Friday, July 9, 2010
Riak from Curl
                          Putting Data In




basho
Friday, July 9, 2010
Taking Data Out




basho
Friday, July 9, 2010
Deleting The Data




basho
Friday, July 9, 2010
Finally, Ruby Stuff

                       •Sean Cribbs - RDRC Training
                       •riak-client - basic client
                       •ripple - associations, ActiveModel
                       •Really Elegant Code

basho
Friday, July 9, 2010
riak-client
                       gem install riak-client




basho
Friday, July 9, 2010
riak-client
                        get the data




basho
Friday, July 9, 2010
riak-client
                         moar datas




basho
Friday, July 9, 2010
riak client
                          got beer




basho
Friday, July 9, 2010
riak-client
                         why yes, I do




basho
Friday, July 9, 2010
Link Walking
              http://localhost:8098/riak/beers/dnr/bars,_,1
          http://localhost:8098/riak/bars/blue_note/beers,tap,1


                       http://localhost:8098/riak/areas/midtown/
                                   /bars,tap,_/beers,_,1




basho
Friday, July 9, 2010
riak-client
                        find me a dnr!




basho
Friday, July 9, 2010
what does the Fry have on tap?




basho
Friday, July 9, 2010
in a bottle?




basho
Friday, July 9, 2010
riak-client
                         ok, via ruby




basho
Friday, July 9, 2010
riak client
                       via ruby with map reduce




basho
Friday, July 9, 2010
riak-client
                           map




basho
Friday, July 9, 2010
riak-client
                        map and reduce




basho
Friday, July 9, 2010
ripple
                       gem install ripple




basho
Friday, July 9, 2010
schema design
                                   riak_20100704

                       people      riak_20100705
                                                      tweets
                                   nosql_20100705

                                   mongodb_20100705




basho
Friday, July 9, 2010
basho
Friday, July 9, 2010
basho
Friday, July 9, 2010
A Model




basho
Friday, July 9, 2010
Other Features

basho
Friday, July 9, 2010
Riak as a Platform


basho
Friday, July 9, 2010
What’s Coming


basho
Friday, July 9, 2010
THANKS!
                       http://wiki.basho.com
                       riak-users@lists.basho.com
                             freenode #riak


basho
Friday, July 9, 2010

More Related Content

PDF
Persisting dynamic data with mongodb and mongomapper
PDF
Bar Camp Auckland - Mongo DB Presentation BCA4
PDF
Solr, Lucene and Hadoop @ Etsy
PDF
Riak Operations
PDF
Relational Databases to Riak
PDF
Bases de Datos NoSQL - Riak
PDF
Riak Intro
PDF
Everyday - mongodb
Persisting dynamic data with mongodb and mongomapper
Bar Camp Auckland - Mongo DB Presentation BCA4
Solr, Lucene and Hadoop @ Etsy
Riak Operations
Relational Databases to Riak
Bases de Datos NoSQL - Riak
Riak Intro
Everyday - mongodb

Similar to Riak and Ruby (10)

PDF
Riak Core: Building Distributed Applications Without Shared State
PDF
Meet Couch DB
PDF
BDD and Cucumber at barcampGZ
PDF
Web Development With Ruby - From Simple To Complex
PDF
Introduction to CouchDB
PDF
HBase @ Hadoop Day Seattle
PDF
Pig and Python to Process Big Data
PDF
PDF
Debugging your JavaScript
PDF
Distributed Social Networking
Riak Core: Building Distributed Applications Without Shared State
Meet Couch DB
BDD and Cucumber at barcampGZ
Web Development With Ruby - From Simple To Complex
Introduction to CouchDB
HBase @ Hadoop Day Seattle
Pig and Python to Process Big Data
Debugging your JavaScript
Distributed Social Networking
Ad

Recently uploaded (20)

PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPT
Teaching material agriculture food technology
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
A Presentation on Artificial Intelligence
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Modernizing your data center with Dell and AMD
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Review of recent advances in non-invasive hemoglobin estimation
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Unlocking AI with Model Context Protocol (MCP)
Spectral efficient network and resource selection model in 5G networks
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Advanced methodologies resolving dimensionality complications for autism neur...
CIFDAQ's Market Insight: SEC Turns Pro Crypto
MYSQL Presentation for SQL database connectivity
Reach Out and Touch Someone: Haptics and Empathic Computing
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Teaching material agriculture food technology
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
The AUB Centre for AI in Media Proposal.docx
A Presentation on Artificial Intelligence
The Rise and Fall of 3GPP – Time for a Sabbatical?
Modernizing your data center with Dell and AMD
NewMind AI Monthly Chronicles - July 2025
Review of recent advances in non-invasive hemoglobin estimation
Ad

Riak and Ruby

  • 1. Riak and Ruby Grant Schofield Developer Advocate Basho Technologies, Inc. basho Friday, July 9, 2010
  • 2. Grant Schofield (@schofield) basho basho Friday, July 9, 2010
  • 3. NoSQL •Web 2.0, Cloud, Enterprise??? •Useful Reference Point •Not AntiSQL •Schemaless (Mostly) •Diverse •Thoughtful Data (Not just a NoSQL basho Friday, July 9, 2010
  • 4. NoSQL Includes... •Key Value Stores •Document Databases •Graphing Databases •Column Databases •Schemaless MySQL basho Friday, July 9, 2010
  • 5. Prevalent Now •Memcache??? •Session Data •Caching Data •Complements Traditional RDBMS •Not The Magical Unicorn, but Pony Perhaps basho Friday, July 9, 2010
  • 6. Riak •Open Source •Erlang •Dynamo and CAP Theorem Influenced •Advanced Key Value Store •Web Shaped •Distributed by Nature •Ops Obsessed •A Platform basho Friday, July 9, 2010
  • 7. Dynamo Paper •Key Value Store Built By Amazon for Core Services •Sacrifice Availability for Consistency •Consistent Hashing •Merkle Trees •Vector Clocks •Eventually Consistent basho Friday, July 9, 2010
  • 8. CAP Theorem Consistency, Availability, Partition Tolerance •Dr. Eric Brewer •At a Given Point You Get Two of the Three •Riak is Tunable •Eventual Consistency - Not an Excuse to Lose Data basho Friday, July 9, 2010
  • 9. Advanced Key Value Store? •Not Just PUT and GET Key/Values •Multiple Interfaces •Links •Document Like •Pluggable Backend •Map/Reduce •Distributed basho Friday, July 9, 2010
  • 10. Web Shaped •Biggest Distributed System Ever •Works Like the Web •Links •Talks HTTP Restfully •Load Balances Just Like Web Stuff basho Friday, July 9, 2010
  • 11. Fundamentally Distributed •Built From The Start •Masterless •Homogenous •Consistent Hashing •Scales Horizontally •Fault Tolerant (Hinted Handoff) basho Friday, July 9, 2010
  • 12. Consistent Hashing node 0 node 1 2160/4 node 2 node 3 hash(<<"beer">>,<<"dns">>) 2160/2 basho Friday, July 9, 2010
  • 13. N, R, and W •N = Number of Replicas •R = Number of Replicas Needed for a Read •W = Number of Replicas Needed for a Write •DW = Number of Replicas Needed for a Durable Write •N Configurable Per Bucket •R and W Configurable Per Request basho Friday, July 9, 2010
  • 14. R Value get(<<"beer">>,<<"dnr">>, R=2) (N=3) {ok, Object} X basho Friday, July 9, 2010
  • 15. W Value put(<<"beer">>,<<"dnr">>, W=2) (N=3) ok X basho Friday, July 9, 2010
  • 16. N=10, R/W = 2 get/put("beer", "dnr", R/W=2) (N=10) {ok, Object} X X X X X X X X basho Friday, July 9, 2010
  • 17. Riak from Curl Putting Data In basho Friday, July 9, 2010
  • 20. Finally, Ruby Stuff •Sean Cribbs - RDRC Training •riak-client - basic client •ripple - associations, ActiveModel •Really Elegant Code basho Friday, July 9, 2010
  • 21. riak-client gem install riak-client basho Friday, July 9, 2010
  • 22. riak-client get the data basho Friday, July 9, 2010
  • 23. riak-client moar datas basho Friday, July 9, 2010
  • 24. riak client got beer basho Friday, July 9, 2010
  • 25. riak-client why yes, I do basho Friday, July 9, 2010
  • 26. Link Walking http://localhost:8098/riak/beers/dnr/bars,_,1 http://localhost:8098/riak/bars/blue_note/beers,tap,1 http://localhost:8098/riak/areas/midtown/ /bars,tap,_/beers,_,1 basho Friday, July 9, 2010
  • 27. riak-client find me a dnr! basho Friday, July 9, 2010
  • 28. what does the Fry have on tap? basho Friday, July 9, 2010
  • 30. riak-client ok, via ruby basho Friday, July 9, 2010
  • 31. riak client via ruby with map reduce basho Friday, July 9, 2010
  • 32. riak-client map basho Friday, July 9, 2010
  • 33. riak-client map and reduce basho Friday, July 9, 2010
  • 34. ripple gem install ripple basho Friday, July 9, 2010
  • 35. schema design riak_20100704 people riak_20100705 tweets nosql_20100705 mongodb_20100705 basho Friday, July 9, 2010
  • 40. Riak as a Platform basho Friday, July 9, 2010
  • 42. THANKS! http://wiki.basho.com riak-users@lists.basho.com freenode #riak basho Friday, July 9, 2010