SlideShare ist ein Scribd-Unternehmen logo
1 von 85
Overview
Mårten Gustafson
   Stockholm Riak Meetup #1
          2011-03-31
What is Riak
         and what’s the agenda?



Decentralized key-value store
A database ideally suited for web applications
A flexible map/reduce engine
What is Riak
         and what’s the agenda?



Decentralized key-value store
A database ideally suited for web applications
A flexible map/reduce engine
http://www.flickr.com/photos/linneberg/4481309196/
Operations
              HTTP Client
                                              PUT    /bucket/key
                                              GET    /bucket/key
                                              DELETE /bucket/key




                        Item   Item
Item
               Item                    Item
       Item           Item      Item

  Bucket          Bucket          Bucket

         Riak Key/Value Store
An entry

• lives in a bucket
• has a key
• has a value
An entry
                 arbitrary name


• lives in a bucket
             bucket
• has a key
• has a value
An entry
                 arbitrary name


• lives in a bucket
             bucket
• has a key arbitrary name
         key
• has a value
An entry
                 arbitrary name
                                  forms the path
• lives in a bucket
             bucket                 to the value
• has a key arbitrary name
         key
• has a value
An entry
                  arbitrary name
                                   forms the path
• lives in a bucket
             bucket                  to the value
• has a key arbitrary name
         key
• has a value
         value
              a binary blob
             and mime type
An entry
                  arbitrary name
                                        forms the path
• lives in a bucket
             bucket                       to the value
• has a key arbitrary name
         key
• has a value
         value
              a binary blob
             and mime type
                              = Store anything, yay!
Store anything
   bucket meetup
Store anything
                       bucket meetup

key foo.html mime text/html
         <html><body>
              <h1>
   <a href=”bar.html”>foo</a>
             </h1>
        </body></html>
Store anything
                       bucket meetup

key foo.html mime text/html       key bar.html
         <html><body>             mime text/html
              <h1>
   <a href=”bar.html”>foo</a>       <html><body>
             </h1>                 <h1>bar!</h1>
        </body></html>             </body></html>
Store anything
                       bucket meetup

key foo.html mime text/html              key bar.html
         <html><body>                    mime text/html
              <h1>
   <a href=”bar.html”>foo</a>               <html><body>
             </h1>                         <h1>bar!</h1>
        </body></html>                     </body></html>




             http://127.0.0.1:8088/riak/meetup/foo.html
What is Riak
         and what’s the agenda?



Decentralized key-value store
A database ideally suited for web applications
A flexible map/reduce engine
What is Riak
         and what’s the agenda?



Decentralized key-value store
A database ideally suited for web applications
A flexible map/reduce engine
Storage

Riak Key/Value Store
Storage

                 Riak Key/Value Store
Bitcask InnoDB DETS File system   Balanced trees   LRU ETS
Storage

                 Riak Key/Value Store
Bitcask InnoDB DETS File system   Balanced trees   LRU ETS


             disk based,              ram based,
               durable                not durable
Storage

default
                           Riak Key/Value Store
          Bitcask InnoDB DETS File system   Balanced trees   LRU ETS


           commo       disk based,              ram based,
                         durable                not durable
What is Riak
         and what’s the agenda?



Decentralized key-value store
A database ideally suited for web applications
A flexible map/reduce engine
What is Riak
         and what’s the agenda?



Decentralized key-value store
A database ideally suited for web applications
A flexible map/reduce engine
The Ring
The Ring
The Ring
            12     1
     11                    2

10                             3

9                              4

     8                     5
             7     6

          ring size = 12
Consistent Hashing
            12   1
       11            2

  10                     3

   9                     4

       8             5
            7    6
Consistent Hashing
            12   1
       11            2

  10                     3

   9                     4

       8             5
            7    6
Read




“I want “
requires us to know:
where is on the ring?
Read




“I want “
requires us to know:
where is on the ring?
Cluster


One Ring size to rule them all, One Ring size to
find them, One Ring size to bring them all and in
the cluster bind them...
Cluster

                                            node A


                                            node B


                                            node C


ring size = 12
instances = 3
ring size / nodes = ~slices per instances
Cluster

                                            node A


                                            node B


                                            node C


ring size = 12
instances = 3
ring size / nodes = ~slices per instances
Cluster - Read
node A   node B   node C
Cluster - Read
I can haz     ?



                        node A   node B   node C


Hm,       hashes to a
slice of the ring
owned by node C.
Cluster - Read
I can haz   ?



                     node A   node B   node C

                                                Okidoki, now
     Hey C! I need                              where’s he...a yeah
                                                in my fourth slice
Cluster - Read
I can haz   ?



                node A   node B   node C
So what about...
...network partitions?
  node A   node B   node C
...network partitions?
  node A   node B   X   node C
...failed nodes?
node A   node B   node C
...failed nodes?
node A   node B
...concurrent writes?
 node A     node B   node C




 client 1            client 2
...concurrent writes?
 node A
                       ?
                      node B   node C




                 hey, A!
            save     for me
 client 1                      client 2

                                              hey, C!
                                          save     for me
What is Riak
         and what’s the agenda?



Decentralized key-value store
A database ideally suited for web applications
A flexible map/reduce engine
Livin’ on the web

• concurrent users
• unreliable networks
• node failures
The N to the R to the W to the DW and the RW
N_VAL
Client




          Bucket


Node A    Node B   Node C
N_VAL 1
Client




          Bucket


Node A    Node B   Node C
N_VAL 2
Client




          Bucket


Node A    Node B   Node C
N_VAL 3
Client




          Bucket


Node A    Node B   Node C
R
Client   GET /bucket/key?R=1




          Bucket


Node A    Node B   Node C
R
Client   GET /bucket/key?R=1




          Bucket


Node A    Node B   Node C
R
Client   GET /bucket/key?R=2




          Bucket


Node A    Node B   Node C
R
Client   GET /bucket/key?R=2




          Bucket


Node A    Node B   Node C
R
Client   GET /bucket/key?R=2


         Agree?



           Bucket


Node A    Node B    Node C
R
Client   GET /bucket/key?R=2




          Bucket


Node A    Node B   Node C
The N to the R to the W to the DW and the RW
The N to the R to the W to the DW and the RW

Number of copies
ie. distribute to N nodes
Read
      ie. have R nodes agree


           The N to the R to the W to the DW and the RW

Number of copies
ie. distribute to N nodes
Read
      ie. have R nodes agree


           The N to the R to the W to the DW and the RW
                               Write
Number of copies               ie. ack’d by
ie. distribute to N nodes      W nodes
Durable write
      Read                                    ie. persistently written by
      ie. have R nodes agree                  DW nodes



           The N to the R to the W to the DW and the RW
                               Write
Number of copies               ie. ack’d by
ie. distribute to N nodes      W nodes
Durable write
      Read                                    ie. persistently written by
      ie. have R nodes agree                  DW nodes



           The N to the R to the W to the DW and the RW
                               Write                          Read-write
Number of copies               ie. ack’d by
                                                     ie. persistently deleted by
ie. distribute to N nodes      W nodes
                                                                      RW nodes
The Quorum
([node count] / 2) + 1
Bucket properties


http://127.0.0.1:8088/riak/meetup/
Conflicts
When worlds collide
I don’t care!


 allow_mult = false
last_write_wins = true
I do care!


allow_mult = true
I do care!

•   Resolve conflicts in application logic
•   Conflicts exposed as siblings beneath a key
•   Response is HTTP 300 Multiple Choice
•   Served as mime/multipart
Example
HTTP/1.1 300 Multiple Choices

X-Riak-Vclock: a85hYGBgzWDKBVIsrLnh3BlMiYx5rAymfeeO8EGFWRLl30G==

Content-Type: multipart/mixed; boundary=ZZ3eyjUllBi7GXRRMJsUublFxjn

Content-Length: 368

--ZZ3eyjUllBi7GXRRMJsUublFxjn

Content-Type: text/plain


Tuesday

--ZZ3eyjUllBi7GXRRMJsUublFxjn

Content-Type: text/plain


Thursday

--ZZ3eyjUllBi7GXRRMJsUublFxjn--
What is Riak
         and what’s the agenda?



Decentralized key-value store
A database ideally suited for web applications
A flexible map/reduce engine
Map / Reduce


• Javascript or Erlang
• Exposed in the HTTP API
Map / Reduce      count words




     function(v) {
    var words = v.values[0].data.toLowerCase().match('w*','g');
    var counts = [];
    for(var word in words)
      if (words[word] != '') {
        var count = {};
        count[words[word]] = 1;
        counts.push(count);
      }
    return counts;
}
Map / Reduce      count words




function(values) {
  var result = {};
  for (var value in values) {
    for(var word in values[value]) {
      if (word in result)
        result[word] += values[value][word];
      else
        result[word] = values[value][word];
    }
  }
  return [result];
}
Map & Reduce          count words




 Put this in your POST request and let Riak smoke it

{"inputs":"bucket", "query":[{"map":{"language":"javascript",
"source":"function(v) { var words = v.values[0].data.toLowerCase().match(/
w*/g); var counts = []; for(var word in words) if (words[word] != '')
{ var count = {}; count[words[word]] = 1; counts.push(count); } return
counts; }"}},{"reduce":{"language":"javascript", "source":"function(values)
{ var result = {}; for (var value in values) { for(var word in
values[value]) { if (word in result) result[word] += values[value][word];
else result[word] = values[value][word]; } } return [result]; }"}}]}
Map & Reduce          count words
function(v) {
  var words = v.values[0].data.toLowerCase().match('w*','g');
  var counts = [];
  for(var word in words)
    if (words[word] != '') {
      var count = {};
      count[words[word]] = 1;
      counts.push(count);
    }
  return counts;
}


{"inputs":"bucket", "query":[{"map":{"language":"javascript",
"source":"function(v) { var words = v.values[0].data.toLowerCase().match(/
w*/g); var counts = []; for(var word in words) if (words[word] != '')
{ var count = {}; count[words[word]] = 1; counts.push(count); } return
counts; }"}},{"reduce":{"language":"javascript", "source":"function(values)
{ var result = {}; for (var value in values) { for(var word in
values[value]) { if (word in result) result[word] += values[value][word];
else result[word] = values[value][word]; } } return [result]; }"}}]}
Map & Reduce          count words
function(values) {
  var result = {};
  for (var value in values) {
    for(var word in values[value]) {
      if (word in result)
        result[word] += values[value][word];
      else
        result[word] = values[value][word];
    }
  }
  return [result];
}

{"inputs":"bucket", "query":[{"map":{"language":"javascript",
"source":"function(v) { var words = v.values[0].data.toLowerCase().match(/
w*/g); var counts = []; for(var word in words) if (words[word] != '')
{ var count = {}; count[words[word]] = 1; counts.push(count); } return
counts; }"}},{"reduce":{"language":"javascript", "source":"function(values)
{ var result = {}; for (var value in values) { for(var word in
values[value]) { if (word in result) result[word] += values[value][word];
else result[word] = values[value][word]; } } return [result]; }"}}]}
Map / Reduce


  Demo
Links


• Non-enforced
• Traversable
Links


Demo
The whole enchilada
     HTTP API             Riak Search                                 Luwak
                     Riak Key/Value Store
  Bitcask   InnoDB     DETS         File system       Balanced trees          LRU ETS

                                 Riak Core
             Membership management                Work distribution
                       leave/join


              Cluster state                       Partitioning
               gossip protocol         (consistent hashing, hinted handoff)


                             Erlang / OTP
Try it

          downloads.basho.com


            brew install riak


Web admin @ github.com/gmaurice/Riaktive
Resources

Riak Fast Track @ wiki.basho.com


       #riak @ freenode


       github.com/basho/
Thanks for listening

Mårten Gustafson
@martengustafson

http://marten.gustafson.pp.se/

marten.gustafson@gmail.com

Weitere ähnliche Inhalte

Was ist angesagt?

Thousands of Threads and Blocking I/O
Thousands of Threads and Blocking I/OThousands of Threads and Blocking I/O
Thousands of Threads and Blocking I/OGeorge Cao
 
Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Hiroshi SHIBATA
 
Developing polyglot persistence applications (devnexus 2013)
Developing polyglot persistence applications (devnexus 2013)Developing polyglot persistence applications (devnexus 2013)
Developing polyglot persistence applications (devnexus 2013)Chris Richardson
 
Storing VMs with Cinder and Ceph RBD.pdf
Storing VMs with Cinder and Ceph RBD.pdfStoring VMs with Cinder and Ceph RBD.pdf
Storing VMs with Cinder and Ceph RBD.pdfOpenStack Foundation
 
What you need to know about ceph
What you need to know about cephWhat you need to know about ceph
What you need to know about cephEmma Haruka Iwao
 
QCT Ceph Solution - Design Consideration and Reference Architecture
QCT Ceph Solution - Design Consideration and Reference ArchitectureQCT Ceph Solution - Design Consideration and Reference Architecture
QCT Ceph Solution - Design Consideration and Reference ArchitecturePatrick McGarry
 
Embrace NoSQL and Eventual Consistency with Ripple
Embrace NoSQL and Eventual Consistency with RippleEmbrace NoSQL and Eventual Consistency with Ripple
Embrace NoSQL and Eventual Consistency with RippleSean Cribbs
 
Developing polyglot persistence applications (SpringOne China 2012)
Developing polyglot persistence applications (SpringOne China 2012)Developing polyglot persistence applications (SpringOne China 2012)
Developing polyglot persistence applications (SpringOne China 2012)Chris Richardson
 
Developing polyglot applications on Cloud Foundry (#oredev 2012)
Developing polyglot applications on Cloud Foundry (#oredev 2012)Developing polyglot applications on Cloud Foundry (#oredev 2012)
Developing polyglot applications on Cloud Foundry (#oredev 2012)Chris Richardson
 
Openstack with ceph
Openstack with cephOpenstack with ceph
Openstack with cephIan Colle
 
drupal 7 amfserver presentation: integrating flash and drupal
drupal 7 amfserver presentation: integrating flash and drupaldrupal 7 amfserver presentation: integrating flash and drupal
drupal 7 amfserver presentation: integrating flash and drupalrolf vreijdenberger
 
The container revolution, and what it means to operators.pptx
The container revolution, and what it means to operators.pptxThe container revolution, and what it means to operators.pptx
The container revolution, and what it means to operators.pptxRobert Starmer
 
Basho and Riak at GOTO Stockholm: "Don't Use My Database."
Basho and Riak at GOTO Stockholm:  "Don't Use My Database."Basho and Riak at GOTO Stockholm:  "Don't Use My Database."
Basho and Riak at GOTO Stockholm: "Don't Use My Database."Basho Technologies
 
Ceph Introduction 2017
Ceph Introduction 2017  Ceph Introduction 2017
Ceph Introduction 2017 Karan Singh
 
Developing polyglot persistence applications #javaone 2012
Developing polyglot persistence applications  #javaone 2012Developing polyglot persistence applications  #javaone 2012
Developing polyglot persistence applications #javaone 2012Chris Richardson
 
New Ceph capabilities and Reference Architectures
New Ceph capabilities and Reference ArchitecturesNew Ceph capabilities and Reference Architectures
New Ceph capabilities and Reference ArchitecturesKamesh Pemmaraju
 
DConf2015 - Using D for Development of Large Scale Primary Storage
DConf2015 - Using D for Development  of Large Scale Primary StorageDConf2015 - Using D for Development  of Large Scale Primary Storage
DConf2015 - Using D for Development of Large Scale Primary StorageLiran Zvibel
 
HKG15-401: Ceph and Software Defined Storage on ARM servers
HKG15-401: Ceph and Software Defined Storage on ARM serversHKG15-401: Ceph and Software Defined Storage on ARM servers
HKG15-401: Ceph and Software Defined Storage on ARM serversLinaro
 

Was ist angesagt? (20)

Thousands of Threads and Blocking I/O
Thousands of Threads and Blocking I/OThousands of Threads and Blocking I/O
Thousands of Threads and Blocking I/O
 
Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0
 
librados
libradoslibrados
librados
 
Developing polyglot persistence applications (devnexus 2013)
Developing polyglot persistence applications (devnexus 2013)Developing polyglot persistence applications (devnexus 2013)
Developing polyglot persistence applications (devnexus 2013)
 
Storing VMs with Cinder and Ceph RBD.pdf
Storing VMs with Cinder and Ceph RBD.pdfStoring VMs with Cinder and Ceph RBD.pdf
Storing VMs with Cinder and Ceph RBD.pdf
 
What you need to know about ceph
What you need to know about cephWhat you need to know about ceph
What you need to know about ceph
 
QCT Ceph Solution - Design Consideration and Reference Architecture
QCT Ceph Solution - Design Consideration and Reference ArchitectureQCT Ceph Solution - Design Consideration and Reference Architecture
QCT Ceph Solution - Design Consideration and Reference Architecture
 
Embrace NoSQL and Eventual Consistency with Ripple
Embrace NoSQL and Eventual Consistency with RippleEmbrace NoSQL and Eventual Consistency with Ripple
Embrace NoSQL and Eventual Consistency with Ripple
 
Developing polyglot persistence applications (SpringOne China 2012)
Developing polyglot persistence applications (SpringOne China 2012)Developing polyglot persistence applications (SpringOne China 2012)
Developing polyglot persistence applications (SpringOne China 2012)
 
Developing polyglot applications on Cloud Foundry (#oredev 2012)
Developing polyglot applications on Cloud Foundry (#oredev 2012)Developing polyglot applications on Cloud Foundry (#oredev 2012)
Developing polyglot applications on Cloud Foundry (#oredev 2012)
 
Openstack with ceph
Openstack with cephOpenstack with ceph
Openstack with ceph
 
drupal 7 amfserver presentation: integrating flash and drupal
drupal 7 amfserver presentation: integrating flash and drupaldrupal 7 amfserver presentation: integrating flash and drupal
drupal 7 amfserver presentation: integrating flash and drupal
 
The container revolution, and what it means to operators.pptx
The container revolution, and what it means to operators.pptxThe container revolution, and what it means to operators.pptx
The container revolution, and what it means to operators.pptx
 
Basho and Riak at GOTO Stockholm: "Don't Use My Database."
Basho and Riak at GOTO Stockholm:  "Don't Use My Database."Basho and Riak at GOTO Stockholm:  "Don't Use My Database."
Basho and Riak at GOTO Stockholm: "Don't Use My Database."
 
Ceph Introduction 2017
Ceph Introduction 2017  Ceph Introduction 2017
Ceph Introduction 2017
 
Developing polyglot persistence applications #javaone 2012
Developing polyglot persistence applications  #javaone 2012Developing polyglot persistence applications  #javaone 2012
Developing polyglot persistence applications #javaone 2012
 
XenSummit - 08/28/2012
XenSummit - 08/28/2012XenSummit - 08/28/2012
XenSummit - 08/28/2012
 
New Ceph capabilities and Reference Architectures
New Ceph capabilities and Reference ArchitecturesNew Ceph capabilities and Reference Architectures
New Ceph capabilities and Reference Architectures
 
DConf2015 - Using D for Development of Large Scale Primary Storage
DConf2015 - Using D for Development  of Large Scale Primary StorageDConf2015 - Using D for Development  of Large Scale Primary Storage
DConf2015 - Using D for Development of Large Scale Primary Storage
 
HKG15-401: Ceph and Software Defined Storage on ARM servers
HKG15-401: Ceph and Software Defined Storage on ARM serversHKG15-401: Ceph and Software Defined Storage on ARM servers
HKG15-401: Ceph and Software Defined Storage on ARM servers
 

Ähnlich wie 2011 03-31 Riak Stockholm Meetup

Introduction to Riak and Ripple (KC.rb)
Introduction to Riak and Ripple (KC.rb)Introduction to Riak and Ripple (KC.rb)
Introduction to Riak and Ripple (KC.rb)Sean Cribbs
 
Introduction data structure for GraphDB
Introduction data structure for GraphDBIntroduction data structure for GraphDB
Introduction data structure for GraphDBshunya kimura
 
Introducing Riak
Introducing RiakIntroducing Riak
Introducing RiakKevin Smith
 
Introducing Riak
Introducing RiakIntroducing Riak
Introducing RiakKevin Smith
 
Spring one2gx2010 spring-nonrelational_data
Spring one2gx2010 spring-nonrelational_dataSpring one2gx2010 spring-nonrelational_data
Spring one2gx2010 spring-nonrelational_dataRoger Xia
 
Introduction to Riak - Red Dirt Ruby Conf Training
Introduction to Riak - Red Dirt Ruby Conf TrainingIntroduction to Riak - Red Dirt Ruby Conf Training
Introduction to Riak - Red Dirt Ruby Conf TrainingSean Cribbs
 
Redis overview for Software Architecture Forum
Redis overview for Software Architecture ForumRedis overview for Software Architecture Forum
Redis overview for Software Architecture ForumChristopher Spring
 
Advanced querying
Advanced queryingAdvanced querying
Advanced queryingstrmpnk
 
Accelerating NoSQL
Accelerating NoSQLAccelerating NoSQL
Accelerating NoSQLsunnygleason
 
Hibari presentation at NOSQL AFTERNOON in JAPAN on Nov 1,2010
Hibari presentation at NOSQL AFTERNOON in JAPAN on Nov 1,2010Hibari presentation at NOSQL AFTERNOON in JAPAN on Nov 1,2010
Hibari presentation at NOSQL AFTERNOON in JAPAN on Nov 1,2010CLOUDIAN KK
 
Scaling HDFS to Manage Billions of Files
Scaling HDFS to Manage Billions of FilesScaling HDFS to Manage Billions of Files
Scaling HDFS to Manage Billions of FilesHaohui Mai
 
Scaling HDFS to Manage Billions of Files with Key-Value Stores
Scaling HDFS to Manage Billions of Files with Key-Value StoresScaling HDFS to Manage Billions of Files with Key-Value Stores
Scaling HDFS to Manage Billions of Files with Key-Value StoresDataWorks Summit
 
HIbari/NOSQL/Erlang for Big Data at Erlang User Conference 2010
HIbari/NOSQL/Erlang for Big Data at Erlang User Conference 2010HIbari/NOSQL/Erlang for Big Data at Erlang User Conference 2010
HIbari/NOSQL/Erlang for Big Data at Erlang User Conference 2010CLOUDIAN KK
 
Learning Cassandra
Learning CassandraLearning Cassandra
Learning CassandraDave Gardner
 

Ähnlich wie 2011 03-31 Riak Stockholm Meetup (20)

Introduction to Riak and Ripple (KC.rb)
Introduction to Riak and Ripple (KC.rb)Introduction to Riak and Ripple (KC.rb)
Introduction to Riak and Ripple (KC.rb)
 
Introduction data structure for GraphDB
Introduction data structure for GraphDBIntroduction data structure for GraphDB
Introduction data structure for GraphDB
 
Introducing Riak
Introducing RiakIntroducing Riak
Introducing Riak
 
Introducing Riak
Introducing RiakIntroducing Riak
Introducing Riak
 
Spring one2gx2010 spring-nonrelational_data
Spring one2gx2010 spring-nonrelational_dataSpring one2gx2010 spring-nonrelational_data
Spring one2gx2010 spring-nonrelational_data
 
Introduction to Riak - Red Dirt Ruby Conf Training
Introduction to Riak - Red Dirt Ruby Conf TrainingIntroduction to Riak - Red Dirt Ruby Conf Training
Introduction to Riak - Red Dirt Ruby Conf Training
 
Redis overview for Software Architecture Forum
Redis overview for Software Architecture ForumRedis overview for Software Architecture Forum
Redis overview for Software Architecture Forum
 
Advanced querying
Advanced queryingAdvanced querying
Advanced querying
 
Forget The ORM!
Forget The ORM!Forget The ORM!
Forget The ORM!
 
Git Going With DVCS v1.5.1
Git Going With DVCS v1.5.1Git Going With DVCS v1.5.1
Git Going With DVCS v1.5.1
 
Let's Get to the Rapids
Let's Get to the RapidsLet's Get to the Rapids
Let's Get to the Rapids
 
Accelerating NoSQL
Accelerating NoSQLAccelerating NoSQL
Accelerating NoSQL
 
Hibari presentation at NOSQL AFTERNOON in JAPAN on Nov 1,2010
Hibari presentation at NOSQL AFTERNOON in JAPAN on Nov 1,2010Hibari presentation at NOSQL AFTERNOON in JAPAN on Nov 1,2010
Hibari presentation at NOSQL AFTERNOON in JAPAN on Nov 1,2010
 
Scaling HDFS to Manage Billions of Files
Scaling HDFS to Manage Billions of FilesScaling HDFS to Manage Billions of Files
Scaling HDFS to Manage Billions of Files
 
Scaling HDFS to Manage Billions of Files with Key-Value Stores
Scaling HDFS to Manage Billions of Files with Key-Value StoresScaling HDFS to Manage Billions of Files with Key-Value Stores
Scaling HDFS to Manage Billions of Files with Key-Value Stores
 
HIbari/NOSQL/Erlang for Big Data at Erlang User Conference 2010
HIbari/NOSQL/Erlang for Big Data at Erlang User Conference 2010HIbari/NOSQL/Erlang for Big Data at Erlang User Conference 2010
HIbari/NOSQL/Erlang for Big Data at Erlang User Conference 2010
 
NoSQL learnings from the world of Telco
NoSQL learnings from the world of TelcoNoSQL learnings from the world of Telco
NoSQL learnings from the world of Telco
 
Seminar_Final
Seminar_FinalSeminar_Final
Seminar_Final
 
Learning Cassandra
Learning CassandraLearning Cassandra
Learning Cassandra
 
Client storage
Client storageClient storage
Client storage
 

Mehr von Mårten Gustafson

2011 05-12 nosql-fritidsresor
2011 05-12 nosql-fritidsresor2011 05-12 nosql-fritidsresor
2011 05-12 nosql-fritidsresorMårten Gustafson
 
2011-06-01-stockholm-devops-blitz
2011-06-01-stockholm-devops-blitz2011-06-01-stockholm-devops-blitz
2011-06-01-stockholm-devops-blitzMårten Gustafson
 
2011 05-23 metrics-agilasverige-english
2011 05-23 metrics-agilasverige-english2011 05-23 metrics-agilasverige-english
2011 05-23 metrics-agilasverige-englishMårten Gustafson
 
2010-11-12 Databases overview
2010-11-12 Databases overview2010-11-12 Databases overview
2010-11-12 Databases overviewMårten Gustafson
 
WebSphere Message Broker In Shared Runtime Environments
WebSphere Message Broker In Shared Runtime EnvironmentsWebSphere Message Broker In Shared Runtime Environments
WebSphere Message Broker In Shared Runtime EnvironmentsMårten Gustafson
 
WebSphere Message Broker v6.x Overview - 2008-01-09
WebSphere Message Broker v6.x Overview - 2008-01-09WebSphere Message Broker v6.x Overview - 2008-01-09
WebSphere Message Broker v6.x Overview - 2008-01-09Mårten Gustafson
 

Mehr von Mårten Gustafson (6)

2011 05-12 nosql-fritidsresor
2011 05-12 nosql-fritidsresor2011 05-12 nosql-fritidsresor
2011 05-12 nosql-fritidsresor
 
2011-06-01-stockholm-devops-blitz
2011-06-01-stockholm-devops-blitz2011-06-01-stockholm-devops-blitz
2011-06-01-stockholm-devops-blitz
 
2011 05-23 metrics-agilasverige-english
2011 05-23 metrics-agilasverige-english2011 05-23 metrics-agilasverige-english
2011 05-23 metrics-agilasverige-english
 
2010-11-12 Databases overview
2010-11-12 Databases overview2010-11-12 Databases overview
2010-11-12 Databases overview
 
WebSphere Message Broker In Shared Runtime Environments
WebSphere Message Broker In Shared Runtime EnvironmentsWebSphere Message Broker In Shared Runtime Environments
WebSphere Message Broker In Shared Runtime Environments
 
WebSphere Message Broker v6.x Overview - 2008-01-09
WebSphere Message Broker v6.x Overview - 2008-01-09WebSphere Message Broker v6.x Overview - 2008-01-09
WebSphere Message Broker v6.x Overview - 2008-01-09
 

Kürzlich hochgeladen

Introduction to Basketball-PowerPoint Presentation
Introduction to Basketball-PowerPoint PresentationIntroduction to Basketball-PowerPoint Presentation
Introduction to Basketball-PowerPoint PresentationJuliusMacaballug
 
Benifits of Individual And Team Sports-Group 7.pptx
Benifits of Individual And Team Sports-Group 7.pptxBenifits of Individual And Team Sports-Group 7.pptx
Benifits of Individual And Team Sports-Group 7.pptxsherrymieg19
 
JORNADA 3 LIGA MURO 2024GHGHGHGHGHGH.pdf
JORNADA 3 LIGA MURO 2024GHGHGHGHGHGH.pdfJORNADA 3 LIGA MURO 2024GHGHGHGHGHGH.pdf
JORNADA 3 LIGA MURO 2024GHGHGHGHGHGH.pdfArturo Pacheco Alvarez
 
Italy Vs Albania Euro Cup 2024 Italy's Strategy for Success.docx
Italy Vs Albania Euro Cup 2024 Italy's Strategy for Success.docxItaly Vs Albania Euro Cup 2024 Italy's Strategy for Success.docx
Italy Vs Albania Euro Cup 2024 Italy's Strategy for Success.docxWorld Wide Tickets And Hospitality
 
Spain Vs Italy Showdown Between Italy and Spain Could Determine UEFA Euro 202...
Spain Vs Italy Showdown Between Italy and Spain Could Determine UEFA Euro 202...Spain Vs Italy Showdown Between Italy and Spain Could Determine UEFA Euro 202...
Spain Vs Italy Showdown Between Italy and Spain Could Determine UEFA Euro 202...World Wide Tickets And Hospitality
 
Clash of Titans_ PSG vs Barcelona (1).pdf
Clash of Titans_ PSG vs Barcelona (1).pdfClash of Titans_ PSG vs Barcelona (1).pdf
Clash of Titans_ PSG vs Barcelona (1).pdfMuhammad Hashim
 
PPT on INDIA VS PAKISTAN - A Sports Rivalry
PPT on INDIA VS PAKISTAN - A Sports RivalryPPT on INDIA VS PAKISTAN - A Sports Rivalry
PPT on INDIA VS PAKISTAN - A Sports Rivalryanirbannath184
 
Project & Portfolio, Market Analysis: WWE
Project & Portfolio, Market Analysis: WWEProject & Portfolio, Market Analysis: WWE
Project & Portfolio, Market Analysis: WWEDeShawn Ellis
 
DONAL88 >LINK SLOT PG SOFT TERGACOR 2024
DONAL88 >LINK SLOT PG SOFT TERGACOR 2024DONAL88 >LINK SLOT PG SOFT TERGACOR 2024
DONAL88 >LINK SLOT PG SOFT TERGACOR 2024DONAL88 GACOR
 
JORNADA 2 LIGA MUROBASQUETBOL1 2024.docx
JORNADA 2 LIGA MUROBASQUETBOL1 2024.docxJORNADA 2 LIGA MUROBASQUETBOL1 2024.docx
JORNADA 2 LIGA MUROBASQUETBOL1 2024.docxArturo Pacheco Alvarez
 

Kürzlich hochgeladen (11)

Introduction to Basketball-PowerPoint Presentation
Introduction to Basketball-PowerPoint PresentationIntroduction to Basketball-PowerPoint Presentation
Introduction to Basketball-PowerPoint Presentation
 
Benifits of Individual And Team Sports-Group 7.pptx
Benifits of Individual And Team Sports-Group 7.pptxBenifits of Individual And Team Sports-Group 7.pptx
Benifits of Individual And Team Sports-Group 7.pptx
 
JORNADA 3 LIGA MURO 2024GHGHGHGHGHGH.pdf
JORNADA 3 LIGA MURO 2024GHGHGHGHGHGH.pdfJORNADA 3 LIGA MURO 2024GHGHGHGHGHGH.pdf
JORNADA 3 LIGA MURO 2024GHGHGHGHGHGH.pdf
 
Italy Vs Albania Euro Cup 2024 Italy's Strategy for Success.docx
Italy Vs Albania Euro Cup 2024 Italy's Strategy for Success.docxItaly Vs Albania Euro Cup 2024 Italy's Strategy for Success.docx
Italy Vs Albania Euro Cup 2024 Italy's Strategy for Success.docx
 
Spain Vs Italy Showdown Between Italy and Spain Could Determine UEFA Euro 202...
Spain Vs Italy Showdown Between Italy and Spain Could Determine UEFA Euro 202...Spain Vs Italy Showdown Between Italy and Spain Could Determine UEFA Euro 202...
Spain Vs Italy Showdown Between Italy and Spain Could Determine UEFA Euro 202...
 
Clash of Titans_ PSG vs Barcelona (1).pdf
Clash of Titans_ PSG vs Barcelona (1).pdfClash of Titans_ PSG vs Barcelona (1).pdf
Clash of Titans_ PSG vs Barcelona (1).pdf
 
PPT on INDIA VS PAKISTAN - A Sports Rivalry
PPT on INDIA VS PAKISTAN - A Sports RivalryPPT on INDIA VS PAKISTAN - A Sports Rivalry
PPT on INDIA VS PAKISTAN - A Sports Rivalry
 
Project & Portfolio, Market Analysis: WWE
Project & Portfolio, Market Analysis: WWEProject & Portfolio, Market Analysis: WWE
Project & Portfolio, Market Analysis: WWE
 
DONAL88 >LINK SLOT PG SOFT TERGACOR 2024
DONAL88 >LINK SLOT PG SOFT TERGACOR 2024DONAL88 >LINK SLOT PG SOFT TERGACOR 2024
DONAL88 >LINK SLOT PG SOFT TERGACOR 2024
 
JORNADA 2 LIGA MUROBASQUETBOL1 2024.docx
JORNADA 2 LIGA MUROBASQUETBOL1 2024.docxJORNADA 2 LIGA MUROBASQUETBOL1 2024.docx
JORNADA 2 LIGA MUROBASQUETBOL1 2024.docx
 
NATIONAL SPORTS DAY WRITTEN QUIZ by QUI9
NATIONAL SPORTS DAY WRITTEN QUIZ by QUI9NATIONAL SPORTS DAY WRITTEN QUIZ by QUI9
NATIONAL SPORTS DAY WRITTEN QUIZ by QUI9
 

2011 03-31 Riak Stockholm Meetup

  • 1. Overview Mårten Gustafson Stockholm Riak Meetup #1 2011-03-31
  • 2. What is Riak and what’s the agenda? Decentralized key-value store A database ideally suited for web applications A flexible map/reduce engine
  • 3. What is Riak and what’s the agenda? Decentralized key-value store A database ideally suited for web applications A flexible map/reduce engine
  • 5. Operations HTTP Client PUT /bucket/key GET /bucket/key DELETE /bucket/key Item Item Item Item Item Item Item Item Bucket Bucket Bucket Riak Key/Value Store
  • 6. An entry • lives in a bucket • has a key • has a value
  • 7. An entry arbitrary name • lives in a bucket bucket • has a key • has a value
  • 8. An entry arbitrary name • lives in a bucket bucket • has a key arbitrary name key • has a value
  • 9. An entry arbitrary name forms the path • lives in a bucket bucket to the value • has a key arbitrary name key • has a value
  • 10. An entry arbitrary name forms the path • lives in a bucket bucket to the value • has a key arbitrary name key • has a value value a binary blob and mime type
  • 11. An entry arbitrary name forms the path • lives in a bucket bucket to the value • has a key arbitrary name key • has a value value a binary blob and mime type = Store anything, yay!
  • 12. Store anything bucket meetup
  • 13. Store anything bucket meetup key foo.html mime text/html <html><body> <h1> <a href=”bar.html”>foo</a> </h1> </body></html>
  • 14. Store anything bucket meetup key foo.html mime text/html key bar.html <html><body> mime text/html <h1> <a href=”bar.html”>foo</a> <html><body> </h1> <h1>bar!</h1> </body></html> </body></html>
  • 15. Store anything bucket meetup key foo.html mime text/html key bar.html <html><body> mime text/html <h1> <a href=”bar.html”>foo</a> <html><body> </h1> <h1>bar!</h1> </body></html> </body></html> http://127.0.0.1:8088/riak/meetup/foo.html
  • 16. What is Riak and what’s the agenda? Decentralized key-value store A database ideally suited for web applications A flexible map/reduce engine
  • 17. What is Riak and what’s the agenda? Decentralized key-value store A database ideally suited for web applications A flexible map/reduce engine
  • 19. Storage Riak Key/Value Store Bitcask InnoDB DETS File system Balanced trees LRU ETS
  • 20. Storage Riak Key/Value Store Bitcask InnoDB DETS File system Balanced trees LRU ETS disk based, ram based, durable not durable
  • 21. Storage default Riak Key/Value Store Bitcask InnoDB DETS File system Balanced trees LRU ETS commo disk based, ram based, durable not durable
  • 22. What is Riak and what’s the agenda? Decentralized key-value store A database ideally suited for web applications A flexible map/reduce engine
  • 23. What is Riak and what’s the agenda? Decentralized key-value store A database ideally suited for web applications A flexible map/reduce engine
  • 26. The Ring 12 1 11 2 10 3 9 4 8 5 7 6 ring size = 12
  • 27. Consistent Hashing 12 1 11 2 10 3 9 4 8 5 7 6
  • 28. Consistent Hashing 12 1 11 2 10 3 9 4 8 5 7 6
  • 29. Read “I want “ requires us to know: where is on the ring?
  • 30. Read “I want “ requires us to know: where is on the ring?
  • 31. Cluster One Ring size to rule them all, One Ring size to find them, One Ring size to bring them all and in the cluster bind them...
  • 32. Cluster node A node B node C ring size = 12 instances = 3 ring size / nodes = ~slices per instances
  • 33. Cluster node A node B node C ring size = 12 instances = 3 ring size / nodes = ~slices per instances
  • 34. Cluster - Read node A node B node C
  • 35. Cluster - Read I can haz ? node A node B node C Hm, hashes to a slice of the ring owned by node C.
  • 36. Cluster - Read I can haz ? node A node B node C Okidoki, now Hey C! I need where’s he...a yeah in my fourth slice
  • 37. Cluster - Read I can haz ? node A node B node C
  • 39. ...network partitions? node A node B node C
  • 40. ...network partitions? node A node B X node C
  • 41. ...failed nodes? node A node B node C
  • 43. ...concurrent writes? node A node B node C client 1 client 2
  • 44. ...concurrent writes? node A ? node B node C hey, A! save for me client 1 client 2 hey, C! save for me
  • 45. What is Riak and what’s the agenda? Decentralized key-value store A database ideally suited for web applications A flexible map/reduce engine
  • 46. Livin’ on the web • concurrent users • unreliable networks • node failures
  • 47. The N to the R to the W to the DW and the RW
  • 48. N_VAL Client Bucket Node A Node B Node C
  • 49. N_VAL 1 Client Bucket Node A Node B Node C
  • 50. N_VAL 2 Client Bucket Node A Node B Node C
  • 51. N_VAL 3 Client Bucket Node A Node B Node C
  • 52. R Client GET /bucket/key?R=1 Bucket Node A Node B Node C
  • 53. R Client GET /bucket/key?R=1 Bucket Node A Node B Node C
  • 54. R Client GET /bucket/key?R=2 Bucket Node A Node B Node C
  • 55. R Client GET /bucket/key?R=2 Bucket Node A Node B Node C
  • 56. R Client GET /bucket/key?R=2 Agree? Bucket Node A Node B Node C
  • 57. R Client GET /bucket/key?R=2 Bucket Node A Node B Node C
  • 58. The N to the R to the W to the DW and the RW
  • 59. The N to the R to the W to the DW and the RW Number of copies ie. distribute to N nodes
  • 60. Read ie. have R nodes agree The N to the R to the W to the DW and the RW Number of copies ie. distribute to N nodes
  • 61. Read ie. have R nodes agree The N to the R to the W to the DW and the RW Write Number of copies ie. ack’d by ie. distribute to N nodes W nodes
  • 62. Durable write Read ie. persistently written by ie. have R nodes agree DW nodes The N to the R to the W to the DW and the RW Write Number of copies ie. ack’d by ie. distribute to N nodes W nodes
  • 63. Durable write Read ie. persistently written by ie. have R nodes agree DW nodes The N to the R to the W to the DW and the RW Write Read-write Number of copies ie. ack’d by ie. persistently deleted by ie. distribute to N nodes W nodes RW nodes
  • 68. I don’t care! allow_mult = false last_write_wins = true
  • 70. I do care! • Resolve conflicts in application logic • Conflicts exposed as siblings beneath a key • Response is HTTP 300 Multiple Choice • Served as mime/multipart
  • 71. Example HTTP/1.1 300 Multiple Choices X-Riak-Vclock: a85hYGBgzWDKBVIsrLnh3BlMiYx5rAymfeeO8EGFWRLl30G== Content-Type: multipart/mixed; boundary=ZZ3eyjUllBi7GXRRMJsUublFxjn Content-Length: 368 --ZZ3eyjUllBi7GXRRMJsUublFxjn Content-Type: text/plain Tuesday --ZZ3eyjUllBi7GXRRMJsUublFxjn Content-Type: text/plain Thursday --ZZ3eyjUllBi7GXRRMJsUublFxjn--
  • 72. What is Riak and what’s the agenda? Decentralized key-value store A database ideally suited for web applications A flexible map/reduce engine
  • 73. Map / Reduce • Javascript or Erlang • Exposed in the HTTP API
  • 74. Map / Reduce count words function(v) { var words = v.values[0].data.toLowerCase().match('w*','g'); var counts = []; for(var word in words) if (words[word] != '') { var count = {}; count[words[word]] = 1; counts.push(count); } return counts; }
  • 75. Map / Reduce count words function(values) { var result = {}; for (var value in values) { for(var word in values[value]) { if (word in result) result[word] += values[value][word]; else result[word] = values[value][word]; } } return [result]; }
  • 76. Map & Reduce count words Put this in your POST request and let Riak smoke it {"inputs":"bucket", "query":[{"map":{"language":"javascript", "source":"function(v) { var words = v.values[0].data.toLowerCase().match(/ w*/g); var counts = []; for(var word in words) if (words[word] != '') { var count = {}; count[words[word]] = 1; counts.push(count); } return counts; }"}},{"reduce":{"language":"javascript", "source":"function(values) { var result = {}; for (var value in values) { for(var word in values[value]) { if (word in result) result[word] += values[value][word]; else result[word] = values[value][word]; } } return [result]; }"}}]}
  • 77. Map & Reduce count words function(v) { var words = v.values[0].data.toLowerCase().match('w*','g'); var counts = []; for(var word in words) if (words[word] != '') { var count = {}; count[words[word]] = 1; counts.push(count); } return counts; } {"inputs":"bucket", "query":[{"map":{"language":"javascript", "source":"function(v) { var words = v.values[0].data.toLowerCase().match(/ w*/g); var counts = []; for(var word in words) if (words[word] != '') { var count = {}; count[words[word]] = 1; counts.push(count); } return counts; }"}},{"reduce":{"language":"javascript", "source":"function(values) { var result = {}; for (var value in values) { for(var word in values[value]) { if (word in result) result[word] += values[value][word]; else result[word] = values[value][word]; } } return [result]; }"}}]}
  • 78. Map & Reduce count words function(values) { var result = {}; for (var value in values) { for(var word in values[value]) { if (word in result) result[word] += values[value][word]; else result[word] = values[value][word]; } } return [result]; } {"inputs":"bucket", "query":[{"map":{"language":"javascript", "source":"function(v) { var words = v.values[0].data.toLowerCase().match(/ w*/g); var counts = []; for(var word in words) if (words[word] != '') { var count = {}; count[words[word]] = 1; counts.push(count); } return counts; }"}},{"reduce":{"language":"javascript", "source":"function(values) { var result = {}; for (var value in values) { for(var word in values[value]) { if (word in result) result[word] += values[value][word]; else result[word] = values[value][word]; } } return [result]; }"}}]}
  • 79. Map / Reduce Demo
  • 82. The whole enchilada HTTP API Riak Search Luwak Riak Key/Value Store Bitcask InnoDB DETS File system Balanced trees LRU ETS Riak Core Membership management Work distribution leave/join Cluster state Partitioning gossip protocol (consistent hashing, hinted handoff) Erlang / OTP
  • 83. Try it downloads.basho.com brew install riak Web admin @ github.com/gmaurice/Riaktive
  • 84. Resources Riak Fast Track @ wiki.basho.com #riak @ freenode github.com/basho/
  • 85. Thanks for listening Mårten Gustafson @martengustafson http://marten.gustafson.pp.se/ marten.gustafson@gmail.com