SlideShare uma empresa Scribd logo
1 de 33
Adding Riak to your
NoSQL Bag of Tricks
         NoSQL-NYC, October 2010

                  Alexander Sicular
                         @siculars
Riak, eh?
•   Dynamo inspired

•   Homogeneous

•   Single key-space

•   Distributed

•   Replicated

•   Predictable scaleability

•   Data agnostic
Origins
    Show me your friends...


•    Amazon’s Dynamo
     http://www.allthingsdistributed.com/2007/10/
     amazons_dynamo.html



•    Akamai
     http://www.basho.com/bios.html




                                                    Paramount Home Video
CAP Theorem
                         http://en.wikipedia.org/wiki/CAP_theorem




    •   Consistency

    •   Availability

    •   Partition tolerance


         Pick two?
Riak says: pick two at a time.
                                                                    http://guide.couchdb.org/draft/consistency.html
Homogeneous

•   Every node is the same

•   Any node can service
    any request

•   Nodes gossip on their
    own port
One Ring to Rule Them All
Single 160 bit key space

Huh?

No Sharding!
Distributed (!= replicated)
•   riak is not sharded
                             ★Considerations:
•   vnodes = units of          -must plan maximum ring
    distribution               size
•   vnodes != physical         -think about number of
    nodes (pnodes)             vnodes per pnode
•   vnodes map to pnodes       -generally no less than 10
•   data is distributed at     vnodes per pnode
    the vnode level
Conflict Resolution

• Vector Clocks
• ancestry / divergency maintained
• automatic or manual resolution
★Considerations:
  • X-Riak-ClientId,
  • X-Riak-Vclock
  • allow_mult
Replicated (!= distributed)
• configurable replication values (“N”)
• configurable consistency and availability
  values at read and write time
  -   read

  -   write
  -   durable write
Predictable Scaleability
• How much performance per node?
• Scale in both directions
>bin/riak-admin
>Usage: riak-admin { join   |
  leave | backup | restore |
  test | status | reip |
  js_reload | wait-for-service
  | ringready | transfers }
Data Agnostic
   • schemaless
   • data objects may be of any type
   • binary, text (json, xml)
   • use content types
>curl -v -d 'this is a test' -H "Content-Type: text/plain" 
http://127.0.0.1:8098/riak/testBucket/testKey
Extra Goodies
•   Erlang
    http://www.pragprog.com/titles/jaerlang/
    programming-erlang



•   Code Architecture

•   basho_bench

•   Multiple backends

      •     bitcask

      •     innodb
Code architecture
• Highly modularized
 • riak_core
 • riak_kv
 • bitcask
 • erlang_js
                       http://bitbucket.org/basho
basho_bench
• Performance profiling
• highly customizable
• pretty pictures
• key/value store generalized
  https://wiki.basho.com/display/RIAK/Benchmarking+with+Basho+Bench

  http://pics.livejournal.com/demmonoid/pic/00001sa7
Bitcask
• Riak’s default disk backend
• Write Only Log
• Heavy updates will grow your footprint
   - Look into compaction/merging settings
• Keys are cached in memory with disk offsets
  https://spreadsheets.google.com/ccc?
  key=0Ak4OBkABJPsxdEowYXc2akxnYU9xNkJmbmZscnhaTFE&hl=en&authkey=CMHw8tYO
Speak my language?
•   HTTP
http://wiki.basho.com/display/RIAK/REST+API



•   Protocol Buffers
http://wiki.basho.com/display/RIAK/PBC+API



•   Native Erlang
http://wiki.basho.com/display/RIAK/Erlang+Client
+PBC


                                                                http://www.zazzle.com/
                                                   speak_to_me_in_tagalog_tshirt-235376204895796392
Ok sounds good.
   How do I get it?
>hg clone http://
bitbucket.org/basho/riak
>cd riak
>make all && make rel
       OR if you’re on a mac:
>brew install riak
What does that get
        me?
• Fully functional
• Self contained (<3)
• Default configuration
 -64 vnodes, “riak” cookie, N = 3
Work... like so.

•   Config files
    http://wiki.basho.com/display/RIAK/Configuration+Files




•   app.config
    -ring_creation_size


•   vm.args
    -name, -settings
Fire it up

> bin/riak
> Usage: riak {start|stop|restart|reboot|
  ping|console|attach}

> bin/riak   start
Do Stuff!
    GET:

>   curl -v http://127.0.0.1:8098/ping

>   curl -v http://127.0.0.1:8098/stats

>   curl -v http://127.0.0.1:8098/riak/myBucket

>   curl -v http://127.0.0.1:8098/riak/myBucket/myKey

    PUT:

>   curl -v -X PUT -H "Content-Type: application/json" -d
    '{"backend": "ets"}' http://127.0.0.1:8098/riak/myBucket

>   curl -v -X PUT -d 'test key' http://127.0.0.1:8098/riak/
    myBucket/myKey

>   curl -v -X POST -d 'autogen key' http://127.0.0.1:8098/
    riak/myBucket
Links
•   Lightweight Graphing
•   Practical limitations re. number of links per
    object
•   Unidirectional object linking
•   relationship modeling (one to one, one to many)
•   Returns “Content-Type: multipart/mixed;”
     -   Library needs to be multipart aware
     -   nodejs, formidable
Link Walking
First level depth
>curl http://localhost:8098/riak/myBucket/myKey/_,_,_

Via Map/Reduce
>$ curl -X POST -H "content-type:application/json" 
   http://localhost:8098/mapred --data @-
{"inputs":[["myBucket","myKey"]],"query":[{"link":{}},{"map":
{"language":"javascript","source":"function(v)
{ return [v]; }"}}]}
^D

N level depth
>curl http://localhost:8098/riak/myBucket/myKey/_,_,_/_,_,_


More Info:
http://blog.basho.com/2010/02/24/link-walking-by-example/
http://wiki.basho.com/display/RIAK/Links
http://wiki.basho.com/display/RIAK/REST+API#RESTAPI-Linkwalking
Map/Reduce
• Functions written in either Erlang or
  JavaScript
• Map is distributed to where the data lives
• Reduce is run on the node coordinating the
  M/R
• Erlang > JavaScript
• Tweak JavaScript settings in app.conf
M/R in Riak
•   An input to start from
                                  function(v, keydata, args) {
    • bucket                      
                                  
                                           if (v.values) {
                                             var ret = [], o = {};

    • list of keys                
                                  
                                             o = Riak.mapValuesJson(v)[0]; 
                                             o.lastModifiedParsed = Date.parse(v["values"][0]["metadata"] 
                                  ["X-Riak-Last-Modified"]);
    ★ keys > bucket               
                                  
                                             o.key = v["key"];
                                             ret.push(o);

•   possible link phase           
                                  
                                             return ret;
                                           } else {
                                  
          return [];
•   one or more map phases        
                                  
      };
                                           }


•   (many) possible reduce phase(s)


 Map = SQL Where clause
Reduce = SQL Aggregates (SUM, COUNT, GROUP BY)
Pre/Post Commit
              Hooks
•   Pre Commit                 •   Post Commit

    •   JavaScript or Erlang       •   Erlang

    •   Validation                 •   Indexing

    •   Modify data                •   Messaging

    •   Kill writes
Code demo
• nodejs
• riak-js
• redis
• simple post site
• tags
• json data passing
Chief complaints

   •    No index

   •    No native sort

   •    No increment

   •    No full text search *



                          *Yet ;) inc Riak Search!
http://www.slideshare.net/rklophaus/riak-search-erlang-factory-london-2010
Hybrid architectures
  are the future!
Use tools like Redis to augment shortcomings!
1,456,023 Or “A Lot”

•   At scale, precision does
    not matter in practice.

    •   Google

    •   Twitter



                               http://photography.nationalgeographic.com/photography/enlarge/
                                           okavango-cape-buffalo_pod_image.html
Google
         Look Ma!

         No exact counts!
Twitter


No Totals!



                       No Pagination!
Questions?




         Alexander Sicular
                @siculars

Mais conteúdo relacionado

Mais procurados

Cassandra and materialized views
Cassandra and materialized viewsCassandra and materialized views
Cassandra and materialized viewsGrzegorz Duda
 
Scaling php applications with redis
Scaling php applications with redisScaling php applications with redis
Scaling php applications with redisjimbojsb
 
The OMR GC talk - Ruby Kaigi 2015
The OMR GC talk - Ruby Kaigi 2015The OMR GC talk - Ruby Kaigi 2015
The OMR GC talk - Ruby Kaigi 2015craig lehmann
 
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
 
Apache Sqoop: Unlocking Hadoop for Your Relational Database
Apache Sqoop: Unlocking Hadoop for Your Relational Database Apache Sqoop: Unlocking Hadoop for Your Relational Database
Apache Sqoop: Unlocking Hadoop for Your Relational Database huguk
 
Data Analytics Service Company and Its Ruby Usage
Data Analytics Service Company and Its Ruby UsageData Analytics Service Company and Its Ruby Usage
Data Analytics Service Company and Its Ruby UsageSATOSHI TAGOMORI
 
Data stax academy
Data stax academyData stax academy
Data stax academyDuyhai Doan
 
Introduction to cloudforecast
Introduction to cloudforecastIntroduction to cloudforecast
Introduction to cloudforecastMasahiro Nagano
 
Gemification plan of Standard Library on Ruby
Gemification plan of Standard Library on RubyGemification plan of Standard Library on Ruby
Gemification plan of Standard Library on RubyHiroshi SHIBATA
 
Developing and Deploying Apps with the Postgres FDW
Developing and Deploying Apps with the Postgres FDWDeveloping and Deploying Apps with the Postgres FDW
Developing and Deploying Apps with the Postgres FDWJonathan Katz
 
Riak add presentation
Riak add presentationRiak add presentation
Riak add presentationIlya Bogunov
 
11. From Hadoop to Spark 2/2
11. From Hadoop to Spark 2/211. From Hadoop to Spark 2/2
11. From Hadoop to Spark 2/2Fabio Fumarola
 
Lightning fast analytics with Spark and Cassandra
Lightning fast analytics with Spark and CassandraLightning fast analytics with Spark and Cassandra
Lightning fast analytics with Spark and CassandraRustam Aliyev
 
User defined-functions-cassandra-summit-eu-2014
User defined-functions-cassandra-summit-eu-2014User defined-functions-cassandra-summit-eu-2014
User defined-functions-cassandra-summit-eu-2014Robert Stupp
 
Speed up your Symfony2 application and build awesome features with Redis
Speed up your Symfony2 application and build awesome features with RedisSpeed up your Symfony2 application and build awesome features with Redis
Speed up your Symfony2 application and build awesome features with RedisRicard Clau
 
MongoDB开发应用实践
MongoDB开发应用实践MongoDB开发应用实践
MongoDB开发应用实践iammutex
 
Benchx: An XQuery benchmarking web application
Benchx: An XQuery benchmarking web application Benchx: An XQuery benchmarking web application
Benchx: An XQuery benchmarking web application Andy Bunce
 
Lessons learned while building Omroep.nl
Lessons learned while building Omroep.nlLessons learned while building Omroep.nl
Lessons learned while building Omroep.nlbartzon
 
OSMC 2013 | Log- und Eventmanagement by Bernd Erk
OSMC 2013 |  Log- und Eventmanagement by Bernd ErkOSMC 2013 |  Log- und Eventmanagement by Bernd Erk
OSMC 2013 | Log- und Eventmanagement by Bernd ErkNETWAYS
 

Mais procurados (20)

Cassandra and materialized views
Cassandra and materialized viewsCassandra and materialized views
Cassandra and materialized views
 
Hadoop on osx
Hadoop on osxHadoop on osx
Hadoop on osx
 
Scaling php applications with redis
Scaling php applications with redisScaling php applications with redis
Scaling php applications with redis
 
The OMR GC talk - Ruby Kaigi 2015
The OMR GC talk - Ruby Kaigi 2015The OMR GC talk - Ruby Kaigi 2015
The OMR GC talk - Ruby Kaigi 2015
 
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
 
Apache Sqoop: Unlocking Hadoop for Your Relational Database
Apache Sqoop: Unlocking Hadoop for Your Relational Database Apache Sqoop: Unlocking Hadoop for Your Relational Database
Apache Sqoop: Unlocking Hadoop for Your Relational Database
 
Data Analytics Service Company and Its Ruby Usage
Data Analytics Service Company and Its Ruby UsageData Analytics Service Company and Its Ruby Usage
Data Analytics Service Company and Its Ruby Usage
 
Data stax academy
Data stax academyData stax academy
Data stax academy
 
Introduction to cloudforecast
Introduction to cloudforecastIntroduction to cloudforecast
Introduction to cloudforecast
 
Gemification plan of Standard Library on Ruby
Gemification plan of Standard Library on RubyGemification plan of Standard Library on Ruby
Gemification plan of Standard Library on Ruby
 
Developing and Deploying Apps with the Postgres FDW
Developing and Deploying Apps with the Postgres FDWDeveloping and Deploying Apps with the Postgres FDW
Developing and Deploying Apps with the Postgres FDW
 
Riak add presentation
Riak add presentationRiak add presentation
Riak add presentation
 
11. From Hadoop to Spark 2/2
11. From Hadoop to Spark 2/211. From Hadoop to Spark 2/2
11. From Hadoop to Spark 2/2
 
Lightning fast analytics with Spark and Cassandra
Lightning fast analytics with Spark and CassandraLightning fast analytics with Spark and Cassandra
Lightning fast analytics with Spark and Cassandra
 
User defined-functions-cassandra-summit-eu-2014
User defined-functions-cassandra-summit-eu-2014User defined-functions-cassandra-summit-eu-2014
User defined-functions-cassandra-summit-eu-2014
 
Speed up your Symfony2 application and build awesome features with Redis
Speed up your Symfony2 application and build awesome features with RedisSpeed up your Symfony2 application and build awesome features with Redis
Speed up your Symfony2 application and build awesome features with Redis
 
MongoDB开发应用实践
MongoDB开发应用实践MongoDB开发应用实践
MongoDB开发应用实践
 
Benchx: An XQuery benchmarking web application
Benchx: An XQuery benchmarking web application Benchx: An XQuery benchmarking web application
Benchx: An XQuery benchmarking web application
 
Lessons learned while building Omroep.nl
Lessons learned while building Omroep.nlLessons learned while building Omroep.nl
Lessons learned while building Omroep.nl
 
OSMC 2013 | Log- und Eventmanagement by Bernd Erk
OSMC 2013 |  Log- und Eventmanagement by Bernd ErkOSMC 2013 |  Log- und Eventmanagement by Bernd Erk
OSMC 2013 | Log- und Eventmanagement by Bernd Erk
 

Destaque

Accessibility more than just alt tags
Accessibility more than just alt tagsAccessibility more than just alt tags
Accessibility more than just alt tagsRhiana Heppenstall
 
Api anti patterns
Api anti patternsApi anti patterns
Api anti patternsMike Pearce
 
Pagination Done the Right Way
Pagination Done the Right WayPagination Done the Right Way
Pagination Done the Right WayMarkus Winand
 
Men's views on gender diversity in the workplace 092016
Men's views on gender diversity in the workplace 092016Men's views on gender diversity in the workplace 092016
Men's views on gender diversity in the workplace 092016Todd Mc Brearty
 
Desperately Seeking… Something
Desperately Seeking… SomethingDesperately Seeking… Something
Desperately Seeking… SomethingBarry Briggs
 

Destaque (6)

Accessibility more than just alt tags
Accessibility more than just alt tagsAccessibility more than just alt tags
Accessibility more than just alt tags
 
How to Present
How to PresentHow to Present
How to Present
 
Api anti patterns
Api anti patternsApi anti patterns
Api anti patterns
 
Pagination Done the Right Way
Pagination Done the Right WayPagination Done the Right Way
Pagination Done the Right Way
 
Men's views on gender diversity in the workplace 092016
Men's views on gender diversity in the workplace 092016Men's views on gender diversity in the workplace 092016
Men's views on gender diversity in the workplace 092016
 
Desperately Seeking… Something
Desperately Seeking… SomethingDesperately Seeking… Something
Desperately Seeking… Something
 

Semelhante a Adding Riak to your NoSQL Bag of Tricks

Riak at The NYC Cloud Computing Meetup Group
Riak at The NYC Cloud Computing Meetup GroupRiak at The NYC Cloud Computing Meetup Group
Riak at The NYC Cloud Computing Meetup Groupsiculars
 
Ruby on Rails & PostgreSQL - v2
Ruby on Rails & PostgreSQL - v2Ruby on Rails & PostgreSQL - v2
Ruby on Rails & PostgreSQL - v2John Ashmead
 
Workshop Infrastructure as Code - Suestra
Workshop Infrastructure as Code - SuestraWorkshop Infrastructure as Code - Suestra
Workshop Infrastructure as Code - SuestraMario IC
 
Counters with Riak on Amazon EC2 at Hackover
Counters with Riak on Amazon EC2 at HackoverCounters with Riak on Amazon EC2 at Hackover
Counters with Riak on Amazon EC2 at HackoverAndrei Savu
 
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
 
«ReactiveCocoa и MVVM» — Николай Касьянов, SoftWear
«ReactiveCocoa и MVVM» — Николай Касьянов, SoftWear«ReactiveCocoa и MVVM» — Николай Касьянов, SoftWear
«ReactiveCocoa и MVVM» — Николай Касьянов, SoftWeare-Legion
 
Play Framework and Activator
Play Framework and ActivatorPlay Framework and Activator
Play Framework and ActivatorKevin Webber
 
Nodejs - Should Ruby Developers Care?
Nodejs - Should Ruby Developers Care?Nodejs - Should Ruby Developers Care?
Nodejs - Should Ruby Developers Care?Felix Geisendörfer
 
RSpec on Rails Tutorial
RSpec on Rails TutorialRSpec on Rails Tutorial
RSpec on Rails TutorialWen-Tien Chang
 
Spring one2gx2010 spring-nonrelational_data
Spring one2gx2010 spring-nonrelational_dataSpring one2gx2010 spring-nonrelational_data
Spring one2gx2010 spring-nonrelational_dataRoger Xia
 
Padrino - the Godfather of Sinatra
Padrino - the Godfather of SinatraPadrino - the Godfather of Sinatra
Padrino - the Godfather of SinatraStoyan Zhekov
 
Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)Chris Richardson
 
High-Performance Storage Services with HailDB and Java
High-Performance Storage Services with HailDB and JavaHigh-Performance Storage Services with HailDB and Java
High-Performance Storage Services with HailDB and Javasunnygleason
 
Ruby on Rails : 簡介與入門
Ruby on Rails : 簡介與入門Ruby on Rails : 簡介與入門
Ruby on Rails : 簡介與入門Wen-Tien Chang
 
JCR In Action (ApacheCon US 2009)
JCR In Action (ApacheCon US 2009)JCR In Action (ApacheCon US 2009)
JCR In Action (ApacheCon US 2009)Carsten Ziegeler
 
Scaling web applications with cassandra presentation
Scaling web applications with cassandra presentationScaling web applications with cassandra presentation
Scaling web applications with cassandra presentationMurat Çakal
 

Semelhante a Adding Riak to your NoSQL Bag of Tricks (20)

Riak at The NYC Cloud Computing Meetup Group
Riak at The NYC Cloud Computing Meetup GroupRiak at The NYC Cloud Computing Meetup Group
Riak at The NYC Cloud Computing Meetup Group
 
Ruby on Rails & PostgreSQL - v2
Ruby on Rails & PostgreSQL - v2Ruby on Rails & PostgreSQL - v2
Ruby on Rails & PostgreSQL - v2
 
Rack
RackRack
Rack
 
Workshop Infrastructure as Code - Suestra
Workshop Infrastructure as Code - SuestraWorkshop Infrastructure as Code - Suestra
Workshop Infrastructure as Code - Suestra
 
Counters with Riak on Amazon EC2 at Hackover
Counters with Riak on Amazon EC2 at HackoverCounters with Riak on Amazon EC2 at Hackover
Counters with Riak on Amazon EC2 at Hackover
 
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)
 
KeyValue Stores
KeyValue StoresKeyValue Stores
KeyValue Stores
 
«ReactiveCocoa и MVVM» — Николай Касьянов, SoftWear
«ReactiveCocoa и MVVM» — Николай Касьянов, SoftWear«ReactiveCocoa и MVVM» — Николай Касьянов, SoftWear
«ReactiveCocoa и MVVM» — Николай Касьянов, SoftWear
 
Play Framework and Activator
Play Framework and ActivatorPlay Framework and Activator
Play Framework and Activator
 
Nodejs - Should Ruby Developers Care?
Nodejs - Should Ruby Developers Care?Nodejs - Should Ruby Developers Care?
Nodejs - Should Ruby Developers Care?
 
Wider than rails
Wider than railsWider than rails
Wider than rails
 
RSpec on Rails Tutorial
RSpec on Rails TutorialRSpec on Rails Tutorial
RSpec on Rails Tutorial
 
Nodejs - A quick tour (v6)
Nodejs - A quick tour (v6)Nodejs - A quick tour (v6)
Nodejs - A quick tour (v6)
 
Spring one2gx2010 spring-nonrelational_data
Spring one2gx2010 spring-nonrelational_dataSpring one2gx2010 spring-nonrelational_data
Spring one2gx2010 spring-nonrelational_data
 
Padrino - the Godfather of Sinatra
Padrino - the Godfather of SinatraPadrino - the Godfather of Sinatra
Padrino - the Godfather of Sinatra
 
Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)
 
High-Performance Storage Services with HailDB and Java
High-Performance Storage Services with HailDB and JavaHigh-Performance Storage Services with HailDB and Java
High-Performance Storage Services with HailDB and Java
 
Ruby on Rails : 簡介與入門
Ruby on Rails : 簡介與入門Ruby on Rails : 簡介與入門
Ruby on Rails : 簡介與入門
 
JCR In Action (ApacheCon US 2009)
JCR In Action (ApacheCon US 2009)JCR In Action (ApacheCon US 2009)
JCR In Action (ApacheCon US 2009)
 
Scaling web applications with cassandra presentation
Scaling web applications with cassandra presentationScaling web applications with cassandra presentation
Scaling web applications with cassandra presentation
 

Último

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024The Digital Insurer
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 

Último (20)

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

Adding Riak to your NoSQL Bag of Tricks

  • 1. Adding Riak to your NoSQL Bag of Tricks NoSQL-NYC, October 2010 Alexander Sicular @siculars
  • 2. Riak, eh? • Dynamo inspired • Homogeneous • Single key-space • Distributed • Replicated • Predictable scaleability • Data agnostic
  • 3. Origins Show me your friends... • Amazon’s Dynamo http://www.allthingsdistributed.com/2007/10/ amazons_dynamo.html • Akamai http://www.basho.com/bios.html Paramount Home Video
  • 4. CAP Theorem http://en.wikipedia.org/wiki/CAP_theorem • Consistency • Availability • Partition tolerance Pick two? Riak says: pick two at a time. http://guide.couchdb.org/draft/consistency.html
  • 5. Homogeneous • Every node is the same • Any node can service any request • Nodes gossip on their own port
  • 6. One Ring to Rule Them All Single 160 bit key space Huh? No Sharding!
  • 7. Distributed (!= replicated) • riak is not sharded ★Considerations: • vnodes = units of -must plan maximum ring distribution size • vnodes != physical -think about number of nodes (pnodes) vnodes per pnode • vnodes map to pnodes -generally no less than 10 • data is distributed at vnodes per pnode the vnode level
  • 8. Conflict Resolution • Vector Clocks • ancestry / divergency maintained • automatic or manual resolution ★Considerations: • X-Riak-ClientId, • X-Riak-Vclock • allow_mult
  • 9. Replicated (!= distributed) • configurable replication values (“N”) • configurable consistency and availability values at read and write time - read - write - durable write
  • 10. Predictable Scaleability • How much performance per node? • Scale in both directions >bin/riak-admin >Usage: riak-admin { join | leave | backup | restore | test | status | reip | js_reload | wait-for-service | ringready | transfers }
  • 11. Data Agnostic • schemaless • data objects may be of any type • binary, text (json, xml) • use content types >curl -v -d 'this is a test' -H "Content-Type: text/plain" http://127.0.0.1:8098/riak/testBucket/testKey
  • 12. Extra Goodies • Erlang http://www.pragprog.com/titles/jaerlang/ programming-erlang • Code Architecture • basho_bench • Multiple backends • bitcask • innodb
  • 13. Code architecture • Highly modularized • riak_core • riak_kv • bitcask • erlang_js http://bitbucket.org/basho
  • 14. basho_bench • Performance profiling • highly customizable • pretty pictures • key/value store generalized https://wiki.basho.com/display/RIAK/Benchmarking+with+Basho+Bench http://pics.livejournal.com/demmonoid/pic/00001sa7
  • 15. Bitcask • Riak’s default disk backend • Write Only Log • Heavy updates will grow your footprint - Look into compaction/merging settings • Keys are cached in memory with disk offsets https://spreadsheets.google.com/ccc? key=0Ak4OBkABJPsxdEowYXc2akxnYU9xNkJmbmZscnhaTFE&hl=en&authkey=CMHw8tYO
  • 16. Speak my language? • HTTP http://wiki.basho.com/display/RIAK/REST+API • Protocol Buffers http://wiki.basho.com/display/RIAK/PBC+API • Native Erlang http://wiki.basho.com/display/RIAK/Erlang+Client +PBC http://www.zazzle.com/ speak_to_me_in_tagalog_tshirt-235376204895796392
  • 17. Ok sounds good. How do I get it? >hg clone http:// bitbucket.org/basho/riak >cd riak >make all && make rel OR if you’re on a mac: >brew install riak
  • 18. What does that get me? • Fully functional • Self contained (<3) • Default configuration -64 vnodes, “riak” cookie, N = 3
  • 19. Work... like so. • Config files http://wiki.basho.com/display/RIAK/Configuration+Files • app.config -ring_creation_size • vm.args -name, -settings
  • 20. Fire it up > bin/riak > Usage: riak {start|stop|restart|reboot| ping|console|attach} > bin/riak start
  • 21. Do Stuff! GET: > curl -v http://127.0.0.1:8098/ping > curl -v http://127.0.0.1:8098/stats > curl -v http://127.0.0.1:8098/riak/myBucket > curl -v http://127.0.0.1:8098/riak/myBucket/myKey PUT: > curl -v -X PUT -H "Content-Type: application/json" -d '{"backend": "ets"}' http://127.0.0.1:8098/riak/myBucket > curl -v -X PUT -d 'test key' http://127.0.0.1:8098/riak/ myBucket/myKey > curl -v -X POST -d 'autogen key' http://127.0.0.1:8098/ riak/myBucket
  • 22. Links • Lightweight Graphing • Practical limitations re. number of links per object • Unidirectional object linking • relationship modeling (one to one, one to many) • Returns “Content-Type: multipart/mixed;” - Library needs to be multipart aware - nodejs, formidable
  • 23. Link Walking First level depth >curl http://localhost:8098/riak/myBucket/myKey/_,_,_ Via Map/Reduce >$ curl -X POST -H "content-type:application/json" http://localhost:8098/mapred --data @- {"inputs":[["myBucket","myKey"]],"query":[{"link":{}},{"map": {"language":"javascript","source":"function(v) { return [v]; }"}}]} ^D N level depth >curl http://localhost:8098/riak/myBucket/myKey/_,_,_/_,_,_ More Info: http://blog.basho.com/2010/02/24/link-walking-by-example/ http://wiki.basho.com/display/RIAK/Links http://wiki.basho.com/display/RIAK/REST+API#RESTAPI-Linkwalking
  • 24. Map/Reduce • Functions written in either Erlang or JavaScript • Map is distributed to where the data lives • Reduce is run on the node coordinating the M/R • Erlang > JavaScript • Tweak JavaScript settings in app.conf
  • 25. M/R in Riak • An input to start from function(v, keydata, args) { • bucket if (v.values) { var ret = [], o = {}; • list of keys o = Riak.mapValuesJson(v)[0]; o.lastModifiedParsed = Date.parse(v["values"][0]["metadata"] ["X-Riak-Last-Modified"]); ★ keys > bucket o.key = v["key"]; ret.push(o); • possible link phase return ret; } else { return []; • one or more map phases }; } • (many) possible reduce phase(s) Map = SQL Where clause Reduce = SQL Aggregates (SUM, COUNT, GROUP BY)
  • 26. Pre/Post Commit Hooks • Pre Commit • Post Commit • JavaScript or Erlang • Erlang • Validation • Indexing • Modify data • Messaging • Kill writes
  • 27. Code demo • nodejs • riak-js • redis • simple post site • tags • json data passing
  • 28. Chief complaints • No index • No native sort • No increment • No full text search * *Yet ;) inc Riak Search! http://www.slideshare.net/rklophaus/riak-search-erlang-factory-london-2010
  • 29. Hybrid architectures are the future! Use tools like Redis to augment shortcomings!
  • 30. 1,456,023 Or “A Lot” • At scale, precision does not matter in practice. • Google • Twitter http://photography.nationalgeographic.com/photography/enlarge/ okavango-cape-buffalo_pod_image.html
  • 31. Google Look Ma! No exact counts!
  • 32. Twitter No Totals! No Pagination!
  • 33. Questions? Alexander Sicular @siculars

Notas do Editor