SlideShare a Scribd company logo
Jon Meredith   Basho Technologies



Tuesday, December 7, 2010
WHAT IS IT?




Tuesday, December 7, 2010
Riak is
                            a scalable, highly-available, networked
                                        key/value store.



 basho
Tuesday, December 7, 2010
Inspired by Amazon’s Dynamo
                              ...with some enhancements.

                                   Open Source


 basho
Tuesday, December 7, 2010
Riak is
                            a scalable, highly-available, networked
                                     key/value store.



Tuesday, December 7, 2010
• Stores   and retrieves data against a key.

                            • Encode    your data how you like it.

                            • Keys   are organized into buckets.




 basho
Tuesday, December 7, 2010
BASIC OPERATIONS

                                  get
                                  put
                                 delete


 basho
Tuesday, December 7, 2010
• Riak   also stores metadata against keys

                             • Content Type, Charset, Encoding, ...

                             • Custom     application metadata




 basho
Tuesday, December 7, 2010
Riak is
                            a scalable, highly-available, networked
                                          key/value store.


 basho
Tuesday, December 7, 2010
bucket: pivotal
                            key: greeting
                            value: “<h1>Hi Pivotal<h1>”
                            metadata:
                              content-type=text/html
                              charset=utf8




 basho
Tuesday, December 7, 2010
>     PUT /riak/pivotal/greeting HTTP/1.1
               >     User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8l zlib/1.2.3
               >     Host: 127.0.0.1:8098
               >     Accept: */*
               >     content-type: text/html
               >     charset: utf8
               >     Content-Length: 19
               >
               >     <h1>Hi Pivotal<h1>

               < HTTP/1.1 200 OK
               < X-Riak-Vclock: a85hYGBgzWDKBVIsTNPiOTOYEhnzWBm+5uUf5YMIszUnMdcLv4dKsOTDJVhYPx1JwiLMeH/
               bU6iwWj6yMUwtt6yQJbIA
               < Vary: Accept-Encoding
               < Server: MochiWeb/1.1 WebMachine/1.6 (eat around the stinger)
               < Link: </riak/pivotal>; rel="up"
               < Date: Mon, 24 May 2010 21:44:06 GMT
               < Content-Type: text/html
               < Content-Length: 19
               <




 basho
Tuesday, December 7, 2010
> GET /riak/pivotal/greeting HTTP/1.1
               > User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8l zlib/1.2.3
               > Host: localhost:8098
               > Accept: */*
               >
               < HTTP/1.1 200 OK
               < X-Riak-Vclock: a85hYGBgymDKBVIsrDk3LTOYEhnzWBmUmtOP8kGE2ZqTmNf8Xg6VCAJJZAEA
               < Vary: Accept-Encoding
               < Server: MochiWeb/1.1 WebMachine/1.6 (eat around the stinger)
               < Link: </riak/pivotal>; rel="up"
               < Last-Modified: Tue, 18 May 2010 21:32:02 GMT
               < ETag: 1VW7QmCuyofVCuQbqBNVYh
               < Date: Tue, 18 May 2010 21:32:06 GMT
               < Content-Type: text/html; charset=utf8
               < Content-Length: 19
               <
               * Connection #0 to host localhost left intact
               * Closing connection #0
               <h1>Hi Pivotal</h1>




 basho
Tuesday, December 7, 2010
OTHER INTERFACES TOO!


        • Protocol            Buffers Client

              • Messages         encoded using Protocol Buffers

              • 3-10x        speedups depending on data

        • Native            Erlang client



 basho
Tuesday, December 7, 2010
Riak is
                            a scalable, highly-available, networked
                                      key/value store.



Tuesday, December 7, 2010
Riak was designed to scale horizontally.




 basho
Tuesday, December 7, 2010
Tuesday, December 7, 2010
Tuesday, December 7, 2010
Tuesday, December 7, 2010
Tuesday, December 7, 2010
Tuesday, December 7, 2010
Riak is
                        a scalable, highly-available, networked
                                       key/value store.



Tuesday, December 7, 2010
Tuesday, December 7, 2010
Tuesday, December 7, 2010
Tuesday, December 7, 2010
#Replicas - N            R+W > N
   #Get response - R
   #Put responses - W       for quorum




Tuesday, December 7, 2010
Tuesday, December 7, 2010
Tuesday, December 7, 2010
Tuesday, December 7, 2010
Tuesday, December 7, 2010
Tuesday, December 7, 2010
WILL THE REAL OBJECT PLEASE STEP
                                       FORWARD?

        • Riak              always accepts writes - even during network partitions and other badness

        • Objects              are versioned to automatically detect ancestors/siblings

        • Conflicts              are detected on reads

        • Eventually             consistent



 basho
Tuesday, December 7, 2010
That sounds great...
                            but can I do anything without a key?



Tuesday, December 7, 2010
Query datasets with
                              Map / Reduce


 basho
Tuesday, December 7, 2010
basho
Tuesday, December 7, 2010
function(v) {
                               var m = v.values[0].data.
                                       match('w*','g');
                               var r = [];
                               for(var i in m)
                                  if (m[i] != '') {
                                     var o = {};
                                     o[m[i]] = 1;
                                     r.push(o);
                                  }
                               return r;
                            }




 basho
Tuesday, December 7, 2010
map()
                                    function(v) {
                                       var m = v.values[0].data.
                                               match('w*','g');
                                       var r = [];
                                       for(var i in m)
                                          if (m[i] != '') {
                                             var o = {};
                                             o[m[i]] = 1;
                                             r.push(o);
                                          }
                                       return r;
                                    }




 basho
Tuesday, December 7, 2010
map()

                                    map()           map()




                            map()                           map()




                                    map()           map()

                                            map()
 basho
Tuesday, December 7, 2010
R1

                                 R8        R2




                            R7                  R3




                                 R6        R4

                                      R5
 basho
Tuesday, December 7, 2010
R2
                            reduce()
                                6
                                5
                                8
                                7
                                4
                                3
                                1
                                       function(v) {
                                       	    var r = {};
                                       	    for (var i in v) {
                                       	       for(var w in v[i]) {
                                       	          if (w in r)
                                       	             r[w] += v[i][w];
                                       	          else
                                       	             r[w] = v[i][w];
                                       	       }
                                       	    }
                                       	    return [r];
                                       	 }




 basho
Tuesday, December 7, 2010
Store relationships
                                with links


 basho
Tuesday, December 7, 2010
ch ild
                                                             people/dean
                            child
                                                   chi
                                                      ld
              people/bob            people/alice




                                                             people/claire
 basho
Tuesday, December 7, 2010
he r
                                                    mot
                                                        ch ild
                            father                                    people/dean
                            child                       mo
                                                              the
                                                                  r
                                                    chi
                                                         ld
              people/bob             people/alice




                                                                      people/claire
 basho
Tuesday, December 7, 2010
he r
                                                hild     m ot
                                         grandc
                                                             ch ild
                             father                             so  n     people/dean
                              child                          mo
                                                                  the
                            daughter                                  r
                                                          chi
                                                       dau ld
              people/bob                  people/alice    ght
                                       grandc                er
                                              hild



                                                                          people/claire
 basho
Tuesday, December 7, 2010
he r
                                                     m ot
                                                         ch ild
                             father                         so  n     people/dean
                              child                      mo
                                                              the
                            daughter                              r
                                                      chi
                                                   dau ld
           people/bob                 people/alice    ght
                                                         er
          GET /riak/person/bob/people,child,_
                           key link link
                               bucket tag
                                                                      people/claire
 basho
Tuesday, December 7, 2010
he r
                                                       mot
                                                           ch ild
                             father                           so  n     people/dean
                              child                        mo
                                                                the
                            daughter                                r
                                                        chi
                                                     dau ld
          people/bob                 people/alice       ght
                                                           er
         GET /riak/person/bob/people,child,_/_,child,_
                          key link1 link1 link2 link2
                               bucket tag bucket tag
                                                                        people/claire
 basho
Tuesday, December 7, 2010
he r
                                                       mot
                                                           ch ild
                             father                           so  n     people/dean
                              child                        mo
                                                                the
                            daughter                                r
                                                        chi
                                                    dau ld
          people/bob                 people/alice       ght
                                                           er
         GET /riak/person/bob/people,child,1/people,child,_

                                                                        people/claire
 basho
Tuesday, December 7, 2010
COMPARED TO RDBMS

        • No                schema                              • No schema migrations - version your
                                                                 objects
        • No                transactions
                                                                • Noreplication topologies - just add
        • No                joins (but we do have map/reduce)    nodes to scale
        • No      secondary indices (but we do have
             links!)




Tuesday, December 7, 2010
CLIENT LIBRARIES


                                                 Ruby


                                               Javascript
                            Java

                              .NET linq   Twisted Python

 basho
Tuesday, December 7, 2010
RIAK IN PRODUCTION



 basho
Tuesday, December 7, 2010
MOCHI MEDIA
                                                    www.mochimedia.com

        • Multiple             clusters in production

        • Sessions             (web and Flash) - 5 nodes, ~20MM keys - highest traffic
                                                                                                   Developer
        • User              data storage - 3 nodes, bucket-per-game

        • URL               Shortener - 2 nodes, bucket-per-game

        • Social             graph - 3 nodes, OAuth credentials, relationships

                                                                                        Text and link here but
 basho
Tuesday, December 7, 2010
MOZILLA TEST PILOT
                                                        http://bit.ly/aC0i4f



        • Data              collector for anonymized Firefox usage statistics

        • High              peak throughput - pure writes

        • Large             MapReduce queries for analytics             “Riak meets or exceeds all the write
                                                                      performance requirements...it was nice to
                                                                          see predictable performance and
                                                                                stability under load.”

 basho
Tuesday, December 7, 2010
WEGEO

        • Mobile       Productivity / Collaboration App
             - Task lists, Shopping lists, Calendar

        • Event             and Check-in logs

        • Monthly             reports archive                  “Scalability I could understand, on
                                                                a platform I could understand.”
        • Third-party            coupon and deal aggregation


 basho
Tuesday, December 7, 2010
GETTING RIAK
                               Prebuild Packages            The Bleeding Edge




                                                          https://github.com/basho



                                                         http://bitbucket.org/basho
                            http://downloads.basho.com

Tuesday, December 7, 2010
http://wiki.basho.com
                            follow twitter.com/basho/team
                              riak-users@lists.basho.com
                                  #riak on Freenode

 basho
Tuesday, December 7, 2010

More Related Content

PDF
Riak and Ruby
PDF
MongoDB for Perl Developers
PPT
Schema design short
PDF
Curious case of Dust
KEY
PHP API
KEY
Riak in Ten Minutes
PDF
Document-Oriented Databases: Couchdb Primer
PDF
MongoDB on Rails (and Ruby)
Riak and Ruby
MongoDB for Perl Developers
Schema design short
Curious case of Dust
PHP API
Riak in Ten Minutes
Document-Oriented Databases: Couchdb Primer
MongoDB on Rails (and Ruby)

Similar to Riak Intro (20)

PDF
Meet Couch DB
PDF
Node.js and Ruby
PDF
09 Data
PDF
Opening up the Social Web - Standards that are bridging the Islands
PDF
Introduction to SARA's Hadoop Hackathon - dec 7th 2010
PDF
04 Reports
PDF
04 reports
PDF
Introduction to HTML5
PDF
Ruby on CouchDB - SimplyStored and RockingChair
PDF
Distributed Social Networking
PDF
Macruby - RubyConf Presentation 2010
PDF
Node.js - A Quick Tour II
PDF
Web Development With Ruby - From Simple To Complex
PDF
Everyday - mongodb
PDF
Scala in hulu's data platform
PDF
07 problem-solving
PDF
How Steve Jobs Would Disrupt The Truck & Bus Industry
PDF
Will iPython replace bash?
PDF
Will iPython replace Bash?
PDF
Moving to Dojo 1.7 and the path to 2.0
Meet Couch DB
Node.js and Ruby
09 Data
Opening up the Social Web - Standards that are bridging the Islands
Introduction to SARA's Hadoop Hackathon - dec 7th 2010
04 Reports
04 reports
Introduction to HTML5
Ruby on CouchDB - SimplyStored and RockingChair
Distributed Social Networking
Macruby - RubyConf Presentation 2010
Node.js - A Quick Tour II
Web Development With Ruby - From Simple To Complex
Everyday - mongodb
Scala in hulu's data platform
07 problem-solving
How Steve Jobs Would Disrupt The Truck & Bus Industry
Will iPython replace bash?
Will iPython replace Bash?
Moving to Dojo 1.7 and the path to 2.0
Ad

Recently uploaded (20)

PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PDF
August Patch Tuesday
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
TLE Review Electricity (Electricity).pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
A novel scalable deep ensemble learning framework for big data classification...
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
1 - Historical Antecedents, Social Consideration.pdf
PPTX
cloud_computing_Infrastucture_as_cloud_p
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
Getting Started with Data Integration: FME Form 101
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PPTX
Chapter 5: Probability Theory and Statistics
PDF
WOOl fibre morphology and structure.pdf for textiles
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
A comparative analysis of optical character recognition models for extracting...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
August Patch Tuesday
Programs and apps: productivity, graphics, security and other tools
Agricultural_Statistics_at_a_Glance_2022_0.pdf
TLE Review Electricity (Electricity).pptx
Encapsulation_ Review paper, used for researhc scholars
A novel scalable deep ensemble learning framework for big data classification...
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
1 - Historical Antecedents, Social Consideration.pdf
cloud_computing_Infrastucture_as_cloud_p
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
Getting Started with Data Integration: FME Form 101
Heart disease approach using modified random forest and particle swarm optimi...
Chapter 5: Probability Theory and Statistics
WOOl fibre morphology and structure.pdf for textiles
Digital-Transformation-Roadmap-for-Companies.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
NewMind AI Weekly Chronicles - August'25-Week II
A comparative analysis of optical character recognition models for extracting...
Ad

Riak Intro

  • 1. Jon Meredith Basho Technologies Tuesday, December 7, 2010
  • 2. WHAT IS IT? Tuesday, December 7, 2010
  • 3. Riak is a scalable, highly-available, networked key/value store. basho Tuesday, December 7, 2010
  • 4. Inspired by Amazon’s Dynamo ...with some enhancements. Open Source basho Tuesday, December 7, 2010
  • 5. Riak is a scalable, highly-available, networked key/value store. Tuesday, December 7, 2010
  • 6. • Stores and retrieves data against a key. • Encode your data how you like it. • Keys are organized into buckets. basho Tuesday, December 7, 2010
  • 7. BASIC OPERATIONS get put delete basho Tuesday, December 7, 2010
  • 8. • Riak also stores metadata against keys • Content Type, Charset, Encoding, ... • Custom application metadata basho Tuesday, December 7, 2010
  • 9. Riak is a scalable, highly-available, networked key/value store. basho Tuesday, December 7, 2010
  • 10. bucket: pivotal key: greeting value: “<h1>Hi Pivotal<h1>” metadata: content-type=text/html charset=utf8 basho Tuesday, December 7, 2010
  • 11. > PUT /riak/pivotal/greeting HTTP/1.1 > User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8l zlib/1.2.3 > Host: 127.0.0.1:8098 > Accept: */* > content-type: text/html > charset: utf8 > Content-Length: 19 > > <h1>Hi Pivotal<h1> < HTTP/1.1 200 OK < X-Riak-Vclock: a85hYGBgzWDKBVIsTNPiOTOYEhnzWBm+5uUf5YMIszUnMdcLv4dKsOTDJVhYPx1JwiLMeH/ bU6iwWj6yMUwtt6yQJbIA < Vary: Accept-Encoding < Server: MochiWeb/1.1 WebMachine/1.6 (eat around the stinger) < Link: </riak/pivotal>; rel="up" < Date: Mon, 24 May 2010 21:44:06 GMT < Content-Type: text/html < Content-Length: 19 < basho Tuesday, December 7, 2010
  • 12. > GET /riak/pivotal/greeting HTTP/1.1 > User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8l zlib/1.2.3 > Host: localhost:8098 > Accept: */* > < HTTP/1.1 200 OK < X-Riak-Vclock: a85hYGBgymDKBVIsrDk3LTOYEhnzWBmUmtOP8kGE2ZqTmNf8Xg6VCAJJZAEA < Vary: Accept-Encoding < Server: MochiWeb/1.1 WebMachine/1.6 (eat around the stinger) < Link: </riak/pivotal>; rel="up" < Last-Modified: Tue, 18 May 2010 21:32:02 GMT < ETag: 1VW7QmCuyofVCuQbqBNVYh < Date: Tue, 18 May 2010 21:32:06 GMT < Content-Type: text/html; charset=utf8 < Content-Length: 19 < * Connection #0 to host localhost left intact * Closing connection #0 <h1>Hi Pivotal</h1> basho Tuesday, December 7, 2010
  • 13. OTHER INTERFACES TOO! • Protocol Buffers Client • Messages encoded using Protocol Buffers • 3-10x speedups depending on data • Native Erlang client basho Tuesday, December 7, 2010
  • 14. Riak is a scalable, highly-available, networked key/value store. Tuesday, December 7, 2010
  • 15. Riak was designed to scale horizontally. basho Tuesday, December 7, 2010
  • 21. Riak is a scalable, highly-available, networked key/value store. Tuesday, December 7, 2010
  • 25. #Replicas - N R+W > N #Get response - R #Put responses - W for quorum Tuesday, December 7, 2010
  • 31. WILL THE REAL OBJECT PLEASE STEP FORWARD? • Riak always accepts writes - even during network partitions and other badness • Objects are versioned to automatically detect ancestors/siblings • Conflicts are detected on reads • Eventually consistent basho Tuesday, December 7, 2010
  • 32. That sounds great... but can I do anything without a key? Tuesday, December 7, 2010
  • 33. Query datasets with Map / Reduce basho Tuesday, December 7, 2010
  • 35. function(v) { var m = v.values[0].data. match('w*','g'); var r = []; for(var i in m) if (m[i] != '') { var o = {}; o[m[i]] = 1; r.push(o); } return r; } basho Tuesday, December 7, 2010
  • 36. map() function(v) { var m = v.values[0].data. match('w*','g'); var r = []; for(var i in m) if (m[i] != '') { var o = {}; o[m[i]] = 1; r.push(o); } return r; } basho Tuesday, December 7, 2010
  • 37. map() map() map() map() map() map() map() map() basho Tuesday, December 7, 2010
  • 38. R1 R8 R2 R7 R3 R6 R4 R5 basho Tuesday, December 7, 2010
  • 39. R2 reduce() 6 5 8 7 4 3 1 function(v) { var r = {}; for (var i in v) { for(var w in v[i]) { if (w in r) r[w] += v[i][w]; else r[w] = v[i][w]; } } return [r]; } basho Tuesday, December 7, 2010
  • 40. Store relationships with links basho Tuesday, December 7, 2010
  • 41. ch ild people/dean child chi ld people/bob people/alice people/claire basho Tuesday, December 7, 2010
  • 42. he r mot ch ild father people/dean child mo the r chi ld people/bob people/alice people/claire basho Tuesday, December 7, 2010
  • 43. he r hild m ot grandc ch ild father so n people/dean child mo the daughter r chi dau ld people/bob people/alice ght grandc er hild people/claire basho Tuesday, December 7, 2010
  • 44. he r m ot ch ild father so n people/dean child mo the daughter r chi dau ld people/bob people/alice ght er GET /riak/person/bob/people,child,_ key link link bucket tag people/claire basho Tuesday, December 7, 2010
  • 45. he r mot ch ild father so n people/dean child mo the daughter r chi dau ld people/bob people/alice ght er GET /riak/person/bob/people,child,_/_,child,_ key link1 link1 link2 link2 bucket tag bucket tag people/claire basho Tuesday, December 7, 2010
  • 46. he r mot ch ild father so n people/dean child mo the daughter r chi dau ld people/bob people/alice ght er GET /riak/person/bob/people,child,1/people,child,_ people/claire basho Tuesday, December 7, 2010
  • 47. COMPARED TO RDBMS • No schema • No schema migrations - version your objects • No transactions • Noreplication topologies - just add • No joins (but we do have map/reduce) nodes to scale • No secondary indices (but we do have links!) Tuesday, December 7, 2010
  • 48. CLIENT LIBRARIES Ruby Javascript Java .NET linq Twisted Python basho Tuesday, December 7, 2010
  • 49. RIAK IN PRODUCTION basho Tuesday, December 7, 2010
  • 50. MOCHI MEDIA www.mochimedia.com • Multiple clusters in production • Sessions (web and Flash) - 5 nodes, ~20MM keys - highest traffic Developer • User data storage - 3 nodes, bucket-per-game • URL Shortener - 2 nodes, bucket-per-game • Social graph - 3 nodes, OAuth credentials, relationships Text and link here but basho Tuesday, December 7, 2010
  • 51. MOZILLA TEST PILOT http://bit.ly/aC0i4f • Data collector for anonymized Firefox usage statistics • High peak throughput - pure writes • Large MapReduce queries for analytics “Riak meets or exceeds all the write performance requirements...it was nice to see predictable performance and stability under load.” basho Tuesday, December 7, 2010
  • 52. WEGEO • Mobile Productivity / Collaboration App - Task lists, Shopping lists, Calendar • Event and Check-in logs • Monthly reports archive “Scalability I could understand, on a platform I could understand.” • Third-party coupon and deal aggregation basho Tuesday, December 7, 2010
  • 53. GETTING RIAK Prebuild Packages The Bleeding Edge https://github.com/basho http://bitbucket.org/basho http://downloads.basho.com Tuesday, December 7, 2010
  • 54. http://wiki.basho.com follow twitter.com/basho/team riak-users@lists.basho.com #riak on Freenode basho Tuesday, December 7, 2010