SlideShare a Scribd company logo
1 of 56
Download to read offline
Dynamo: not just datastores
          Susan Potter




         September 2011
Overview: In a nutshell




      Figure: "a highly available key-value storage system"
Overview: Not for all apps
Overview: Agenda


  Distribution & consistency   Riak abstractions

  t - Fault tolerance          Building an application

  N, R, W                      Considerations

  Dynamo techniques            Oh, the possibilities!
Distributed models & consistency
     Are you on ACID?
     Are your apps ACID?
     Few apps require
     strong consistency
     Embrace BASE
     for high availability
Distributed models & consistency
     Are you on ACID?
     Are your apps ACID?
     Few apps require
     strong consistency
     Embrace BASE
     for high availability
Distributed models & consistency
     Are you on ACID?
     Are your apps ACID?
     Few apps require
     strong consistency
     Embrace BASE
     for high availability
Distributed models & consistency
     Are you on ACID?
     Are your apps ACID?
     Few apps require
     strong consistency
     Embrace BASE
     for high availability
Distributed models & consistency



                   BASE
 Basically Available Soft-state Eventual consistency
Distributed models & consistency



                   BASE
 Basically Available Soft-state Eventual consistency

                  </RANT>
t-Fault tolerance: Two kinds of failure
t-Fault tolerance: More on failure


     Failstop
     fail in well understood / deterministic ways




     Byzantine
     fail in arbitrary non-deterministic ways
t-Fault tolerance: More on failure


     Failstop
     fail in well understood / deterministic ways

     t-Fault tolerance means t + 1 nodes

     Byzantine
     fail in arbitrary non-deterministic ways
t-Fault tolerance: More on failure


     Failstop
     fail in well understood / deterministic ways

     t-Fault tolerance means t + 1 nodes

     Byzantine
     fail in arbitrary non-deterministic ways
t-Fault tolerance: More on failure


     Failstop
     fail in well understood / deterministic ways

     t-Fault tolerance means t + 1 nodes

     Byzantine
     fail in arbitrary non-deterministic ways

     t-Fault tolerance means 2t + 1 nodes
CAP Controls: N, R, W

    N = number of replicas
    must be 1 ≤ N ≤ nodes

    R = number of responding read nodes
    can be set per request

    W = number of responding write nodes
    can be set per request

    Q = quorum "majority rules"
    set in stone: Q = N/2 + 1

    Tunability
    when R = W = N =⇒ strong

    when R + W > N =⇒ quorum where W = 1, R = N or W = N, R = 1 or W = R = Q
CAP Controls: N, R, W

    N = number of replicas
    must be 1 ≤ N ≤ nodes

    R = number of responding read nodes
    can be set per request

    W = number of responding write nodes
    can be set per request

    Q = quorum "majority rules"
    set in stone: Q = N/2 + 1

    Tunability
    when R = W = N =⇒ strong

    when R + W > N =⇒ quorum where W = 1, R = N or W = N, R = 1 or W = R = Q
CAP Controls: N, R, W

    N = number of replicas
    must be 1 ≤ N ≤ nodes

    R = number of responding read nodes
    can be set per request

    W = number of responding write nodes
    can be set per request

    Q = quorum "majority rules"
    set in stone: Q = N/2 + 1

    Tunability
    when R = W = N =⇒ strong

    when R + W > N =⇒ quorum where W = 1, R = N or W = N, R = 1 or W = R = Q
CAP Controls: N, R, W

    N = number of replicas
    must be 1 ≤ N ≤ nodes

    R = number of responding read nodes
    can be set per request

    W = number of responding write nodes
    can be set per request

    Q = quorum "majority rules"
    set in stone: Q = N/2 + 1

    Tunability
    when R = W = N =⇒ strong

    when R + W > N =⇒ quorum where W = 1, R = N or W = N, R = 1 or W = R = Q
CAP Controls: N, R, W

    N = number of replicas
    must be 1 ≤ N ≤ nodes

    R = number of responding read nodes
    can be set per request

    W = number of responding write nodes
    can be set per request

    Q = quorum "majority rules"
    set in stone: Q = N/2 + 1

    Tunability
    when R = W = N =⇒ strong

    when R + W > N =⇒ quorum where W = 1, R = N or W = N, R = 1 or W = R = Q
Dynamo: Properties

    Decentralized
    no masters exist

    Homogeneous
    nodes have same capabilities

    No Global State
    no SPOFs for global state

    Deterministic Replica Placement
    each node can calculate where replicas should exist for key

    Logical Time
    No reliance on physical time
Dynamo: Properties

    Decentralized
    no masters exist

    Homogeneous
    nodes have same capabilities

    No Global State
    no SPOFs for global state

    Deterministic Replica Placement
    each node can calculate where replicas should exist for key

    Logical Time
    No reliance on physical time
Dynamo: Properties

    Decentralized
    no masters exist

    Homogeneous
    nodes have same capabilities

    No Global State
    no SPOFs for global state

    Deterministic Replica Placement
    each node can calculate where replicas should exist for key

    Logical Time
    No reliance on physical time
Dynamo: Properties

    Decentralized
    no masters exist

    Homogeneous
    nodes have same capabilities

    No Global State
    no SPOFs for global state

    Deterministic Replica Placement
    each node can calculate where replicas should exist for key

    Logical Time
    No reliance on physical time
Dynamo: Properties

    Decentralized
    no masters exist

    Homogeneous
    nodes have same capabilities

    No Global State
    no SPOFs for global state

    Deterministic Replica Placement
    each node can calculate where replicas should exist for key

    Logical Time
    No reliance on physical time
Dynamo: Techniques


       Consistent Hashing

       Vector Clocks

       Gossip Protocol

       Hinted Handoff
Dynamo: Techniques


       Consistent Hashing

       Vector Clocks

       Gossip Protocol

       Hinted Handoff
Dynamo: Consistent hashing




         Figure: PrefsList for K is [C, D, E]
Dynamo: Vector clocks



   -type vclock() ::
 [{actor(), counter()}]
         A occurred-before B if counters in A are
     less than or equal to those in B for each actor
Dynamo: Gossip protocol




        Figure:   "You would never guess what I heard down the pub..."
Dynamo: Hinted handoff




       Figure:   "Here, take the baton and take over from me. KTHXBAI"
riak_core: Abstractions

         Coordinator
         enforces consistency requirements, performing anti-entropy, gen_fsm, coordinates vnodes

         VNodes
         Erlang process, vnode to hashring partition, delegated work for its partition, unit of replication

         Watchers
         gen_event, listens for ring and service events, used to calculate fallback nodes

         Ring Manager
         stores local node copy of ring (and cluster?) data

         Ring Event Handlers
         notified about ring (and cluster?) changes and broadcasts plus metadata changes
riak_core: Abstractions

         Coordinator
         enforces consistency requirements, performing anti-entropy, gen_fsm, coordinates vnodes

         VNodes
         Erlang process, vnode to hashring partition, delegated work for its partition, unit of replication

         Watchers
         gen_event, listens for ring and service events, used to calculate fallback nodes

         Ring Manager
         stores local node copy of ring (and cluster?) data

         Ring Event Handlers
         notified about ring (and cluster?) changes and broadcasts plus metadata changes
riak_core: Abstractions

         Coordinator
         enforces consistency requirements, performing anti-entropy, gen_fsm, coordinates vnodes

         VNodes
         Erlang process, vnode to hashring partition, delegated work for its partition, unit of replication

         Watchers
         gen_event, listens for ring and service events, used to calculate fallback nodes

         Ring Manager
         stores local node copy of ring (and cluster?) data

         Ring Event Handlers
         notified about ring (and cluster?) changes and broadcasts plus metadata changes
riak_core: Abstractions

         Coordinator
         enforces consistency requirements, performing anti-entropy, gen_fsm, coordinates vnodes

         VNodes
         Erlang process, vnode to hashring partition, delegated work for its partition, unit of replication

         Watchers
         gen_event, listens for ring and service events, used to calculate fallback nodes

         Ring Manager
         stores local node copy of ring (and cluster?) data

         Ring Event Handlers
         notified about ring (and cluster?) changes and broadcasts plus metadata changes
riak_core: Abstractions

         Coordinator
         enforces consistency requirements, performing anti-entropy, gen_fsm, coordinates vnodes

         VNodes
         Erlang process, vnode to hashring partition, delegated work for its partition, unit of replication

         Watchers
         gen_event, listens for ring and service events, used to calculate fallback nodes

         Ring Manager
         stores local node copy of ring (and cluster?) data

         Ring Event Handlers
         notified about ring (and cluster?) changes and broadcasts plus metadata changes
riak_core: Coordinator




             Figure:   Header of a coordinator
riak_core: Commands



  -type riak_cmd() ::
{verb(), key(), payload()}
Implement handle_command/3 clause for each command in your
                  callback VNode module
riak_core: VNodes
riak_core: VNodes




        Figure:   Sample handoff functions from RTS example app
riak_core: Project Structure

         rebar ;)
         also written by the Basho team, makes OTP building and deploying much less painful



         dependencies
         add you_app, riak_core, riak_kv, etc. as dependencies to shell project



         new in 1.0 stuff
         cluster vs ring membership, riak_pipe, etc.
riak_core: Project Structure

         rebar ;)
         also written by the Basho team, makes OTP building and deploying much less painful



         dependencies
         add you_app, riak_core, riak_kv, etc. as dependencies to shell project



         new in 1.0 stuff
         cluster vs ring membership, riak_pipe, etc.
riak_core: Project Structure

         rebar ;)
         also written by the Basho team, makes OTP building and deploying much less painful



         dependencies
         add you_app, riak_core, riak_kv, etc. as dependencies to shell project



         new in 1.0 stuff
         cluster vs ring membership, riak_pipe, etc.
Considerations

                 Other:stuff()
     Interface layer
     riak_core apps need to implement their own interface layer, e.g. HTTP, XMPP, AMQP, MsgPack, ProtoBuffers



     Securing application
     riak_core gossip does not address identity/authZ/authN between nodes; relies on Erlang cookies



     Distribution models
     e.g. pipelined, laned vs tiered



     Query/execution models
     e.g. map-reduce (M/R), ASsociated SET (ASSET)
Considerations

                 Other:stuff()
     Interface layer
     riak_core apps need to implement their own interface layer, e.g. HTTP, XMPP, AMQP, MsgPack, ProtoBuffers



     Securing application
     riak_core gossip does not address identity/authZ/authN between nodes; relies on Erlang cookies



     Distribution models
     e.g. pipelined, laned vs tiered



     Query/execution models
     e.g. map-reduce (M/R), ASsociated SET (ASSET)
Considerations

                 Other:stuff()
     Interface layer
     riak_core apps need to implement their own interface layer, e.g. HTTP, XMPP, AMQP, MsgPack, ProtoBuffers



     Securing application
     riak_core gossip does not address identity/authZ/authN between nodes; relies on Erlang cookies



     Distribution models
     e.g. pipelined, laned vs tiered



     Query/execution models
     e.g. map-reduce (M/R), ASsociated SET (ASSET)
Considerations

                 Other:stuff()
     Interface layer
     riak_core apps need to implement their own interface layer, e.g. HTTP, XMPP, AMQP, MsgPack, ProtoBuffers



     Securing application
     riak_core gossip does not address identity/authZ/authN between nodes; relies on Erlang cookies



     Distribution models
     e.g. pipelined, laned vs tiered



     Query/execution models
     e.g. map-reduce (M/R), ASsociated SET (ASSET)
Oh, the possibilities!

                    What:next()
     Concurrency models
     e.g. actor, disruptor, evented/reactor, threading



     Consistency models
     e.g. vector-field, causal, FIFO



     Computation optimizations
     e.g. General Purpose GPU programming, native interfacing (NIFs, JInterface, Scalang?)



     Other optimizations
     e.g. Client discovery, Remote Direct Memory Access (RDMA)
Oh, the possibilities!

                    What:next()
     Concurrency models
     e.g. actor, disruptor, evented/reactor, threading



     Consistency models
     e.g. vector-field, causal, FIFO



     Computation optimizations
     e.g. General Purpose GPU programming, native interfacing (NIFs, JInterface, Scalang?)



     Other optimizations
     e.g. Client discovery, Remote Direct Memory Access (RDMA)
Oh, the possibilities!

                    What:next()
     Concurrency models
     e.g. actor, disruptor, evented/reactor, threading



     Consistency models
     e.g. vector-field, causal, FIFO



     Computation optimizations
     e.g. General Purpose GPU programming, native interfacing (NIFs, JInterface, Scalang?)



     Other optimizations
     e.g. Client discovery, Remote Direct Memory Access (RDMA)
Oh, the possibilities!

                    What:next()
     Concurrency models
     e.g. actor, disruptor, evented/reactor, threading



     Consistency models
     e.g. vector-field, causal, FIFO



     Computation optimizations
     e.g. General Purpose GPU programming, native interfacing (NIFs, JInterface, Scalang?)



     Other optimizations
     e.g. Client discovery, Remote Direct Memory Access (RDMA)
# finger $(whoami)


Login: susan               Name: Susan Potter
Directory: /home/susan     Shell: /bin/zsh
On since Mon 29 Sep 1997 21:18 (GMT) on tty1 from :0
Too much unread mail on me@susanpotter.net
Now working at Assistly! Looking for smart developers!;)
Plan:
  github: mbbx6spp
  twitter: @SusanPotter
Slides & Material

 https://github.com/mbbx6spp/riak_core-templates




      Figure:   http://susanpotter.net/talks/strange-loop/2011/dynamo-not-just-for-datastores/
Examples


       Rebar Templates
       https://github.com/mbbx6spp/riak_core-templates

       Riak Pipes
       https://github.com/basho/riak_pipe

       Riak Zab
       https://github.com/jtuple/riak_zab
Questions?




         Figure:   http://www.flickr.com/photos/42682395@N04/




         @SusanPotter
Questions?




         Figure:   http://www.flickr.com/photos/42682395@N04/




         @SusanPotter

More Related Content

What's hot

The Art of Exploiting Unconventional Use-after-free Bugs in Android Kernel by...
The Art of Exploiting Unconventional Use-after-free Bugs in Android Kernel by...The Art of Exploiting Unconventional Use-after-free Bugs in Android Kernel by...
The Art of Exploiting Unconventional Use-after-free Bugs in Android Kernel by...
CODE BLUE
 

What's hot (20)

Behind modern concurrency primitives
Behind modern concurrency primitivesBehind modern concurrency primitives
Behind modern concurrency primitives
 
Using ngx_lua in UPYUN
Using ngx_lua in UPYUNUsing ngx_lua in UPYUN
Using ngx_lua in UPYUN
 
Discovering OpenBSD on AWS
Discovering OpenBSD on AWSDiscovering OpenBSD on AWS
Discovering OpenBSD on AWS
 
Go Programming Patterns
Go Programming PatternsGo Programming Patterns
Go Programming Patterns
 
BDD - Buzzword Driven Development - Build the next cool app for fun and for.....
BDD - Buzzword Driven Development - Build the next cool app for fun and for.....BDD - Buzzword Driven Development - Build the next cool app for fun and for.....
BDD - Buzzword Driven Development - Build the next cool app for fun and for.....
 
Testing your infrastructure with litmus
Testing your infrastructure with litmusTesting your infrastructure with litmus
Testing your infrastructure with litmus
 
RestMQ - HTTP/Redis based Message Queue
RestMQ - HTTP/Redis based Message QueueRestMQ - HTTP/Redis based Message Queue
RestMQ - HTTP/Redis based Message Queue
 
Lua tech talk
Lua tech talkLua tech talk
Lua tech talk
 
Roll Your Own API Management Platform with nginx and Lua
Roll Your Own API Management Platform with nginx and LuaRoll Your Own API Management Platform with nginx and Lua
Roll Your Own API Management Platform with nginx and Lua
 
Apache MXNet Distributed Training Explained In Depth by Viacheslav Kovalevsky...
Apache MXNet Distributed Training Explained In Depth by Viacheslav Kovalevsky...Apache MXNet Distributed Training Explained In Depth by Viacheslav Kovalevsky...
Apache MXNet Distributed Training Explained In Depth by Viacheslav Kovalevsky...
 
The Art of Exploiting Unconventional Use-after-free Bugs in Android Kernel by...
The Art of Exploiting Unconventional Use-after-free Bugs in Android Kernel by...The Art of Exploiting Unconventional Use-after-free Bugs in Android Kernel by...
The Art of Exploiting Unconventional Use-after-free Bugs in Android Kernel by...
 
Puppet and the HashiStack
Puppet and the HashiStackPuppet and the HashiStack
Puppet and the HashiStack
 
[오픈소스컨설팅] Linux Network Troubleshooting
[오픈소스컨설팅] Linux Network Troubleshooting[오픈소스컨설팅] Linux Network Troubleshooting
[오픈소스컨설팅] Linux Network Troubleshooting
 
Building Distributed System with Celery on Docker Swarm - PyCon JP 2016
Building Distributed System with Celery on Docker Swarm - PyCon JP 2016Building Distributed System with Celery on Docker Swarm - PyCon JP 2016
Building Distributed System with Celery on Docker Swarm - PyCon JP 2016
 
Static Typing in Vault
Static Typing in VaultStatic Typing in Vault
Static Typing in Vault
 
Deep Dive in Docker Overlay Networks
Deep Dive in Docker Overlay NetworksDeep Dive in Docker Overlay Networks
Deep Dive in Docker Overlay Networks
 
Securing Prometheus exporters using HashiCorp Vault
Securing Prometheus exporters using HashiCorp VaultSecuring Prometheus exporters using HashiCorp Vault
Securing Prometheus exporters using HashiCorp Vault
 
Ansible not only for Dummies
Ansible not only for DummiesAnsible not only for Dummies
Ansible not only for Dummies
 
Introduction to Apache ZooKeeper | Big Data Hadoop Spark Tutorial | CloudxLab
Introduction to Apache ZooKeeper | Big Data Hadoop Spark Tutorial | CloudxLabIntroduction to Apache ZooKeeper | Big Data Hadoop Spark Tutorial | CloudxLab
Introduction to Apache ZooKeeper | Big Data Hadoop Spark Tutorial | CloudxLab
 
Running High Performance & Fault-tolerant Elasticsearch Clusters on Docker
Running High Performance & Fault-tolerant Elasticsearch Clusters on DockerRunning High Performance & Fault-tolerant Elasticsearch Clusters on Docker
Running High Performance & Fault-tolerant Elasticsearch Clusters on Docker
 

Viewers also liked

Scalable Architectures - Taming the Twitter Firehose
Scalable Architectures - Taming the Twitter FirehoseScalable Architectures - Taming the Twitter Firehose
Scalable Architectures - Taming the Twitter Firehose
Lorenzo Alberton
 

Viewers also liked (19)

Distributed Developer Workflows using Git
Distributed Developer Workflows using GitDistributed Developer Workflows using Git
Distributed Developer Workflows using Git
 
Writing Bullet-Proof Javascript: By Using CoffeeScript
Writing Bullet-Proof Javascript: By Using CoffeeScriptWriting Bullet-Proof Javascript: By Using CoffeeScript
Writing Bullet-Proof Javascript: By Using CoffeeScript
 
Link Walking with Riak
Link Walking with RiakLink Walking with Riak
Link Walking with Riak
 
Designing for Concurrency
Designing for ConcurrencyDesigning for Concurrency
Designing for Concurrency
 
Functional Algebra: Monoids Applied
Functional Algebra: Monoids AppliedFunctional Algebra: Monoids Applied
Functional Algebra: Monoids Applied
 
Running Free with the Monads
Running Free with the MonadsRunning Free with the Monads
Running Free with the Monads
 
Why Haskell
Why HaskellWhy Haskell
Why Haskell
 
Modern Algorithms and Data Structures - 1. Bloom Filters, Merkle Trees
Modern Algorithms and Data Structures - 1. Bloom Filters, Merkle TreesModern Algorithms and Data Structures - 1. Bloom Filters, Merkle Trees
Modern Algorithms and Data Structures - 1. Bloom Filters, Merkle Trees
 
Scaling Teams, Processes and Architectures
Scaling Teams, Processes and ArchitecturesScaling Teams, Processes and Architectures
Scaling Teams, Processes and Architectures
 
Your data structures are made of maths!
Your data structures are made of maths!Your data structures are made of maths!
Your data structures are made of maths!
 
Scalable Architectures - Taming the Twitter Firehose
Scalable Architectures - Taming the Twitter FirehoseScalable Architectures - Taming the Twitter Firehose
Scalable Architectures - Taming the Twitter Firehose
 
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
 
Graphs in the Database: Rdbms In The Social Networks Age
Graphs in the Database: Rdbms In The Social Networks AgeGraphs in the Database: Rdbms In The Social Networks Age
Graphs in the Database: Rdbms In The Social Networks Age
 
The Art of Scalability - Managing growth
The Art of Scalability - Managing growthThe Art of Scalability - Managing growth
The Art of Scalability - Managing growth
 
NoSQL Databases: Why, what and when
NoSQL Databases: Why, what and whenNoSQL Databases: Why, what and when
NoSQL Databases: Why, what and when
 
Monitoring at scale - Intuitive dashboard design
Monitoring at scale - Intuitive dashboard designMonitoring at scale - Intuitive dashboard design
Monitoring at scale - Intuitive dashboard design
 
Trees In The Database - Advanced data structures
Trees In The Database - Advanced data structuresTrees In The Database - Advanced data structures
Trees In The Database - Advanced data structures
 
Category theory for beginners
Category theory for beginnersCategory theory for beginners
Category theory for beginners
 
Data made out of functions
Data made out of functionsData made out of functions
Data made out of functions
 

Similar to Dynamo: Not Just For Datastores

Introducing Riak
Introducing RiakIntroducing Riak
Introducing Riak
Kevin Smith
 
Introducing Riak
Introducing RiakIntroducing Riak
Introducing Riak
Kevin Smith
 
Handling Data in Mega Scale Web Systems
Handling Data in Mega Scale Web SystemsHandling Data in Mega Scale Web Systems
Handling Data in Mega Scale Web Systems
Vineet Gupta
 
Low Energy Task Scheduling based on Work Stealing
Low Energy Task Scheduling based on Work StealingLow Energy Task Scheduling based on Work Stealing
Low Energy Task Scheduling based on Work Stealing
LEGATO project
 
REEF: Towards a Big Data Stdlib
REEF: Towards a Big Data StdlibREEF: Towards a Big Data Stdlib
REEF: Towards a Big Data Stdlib
DataWorks Summit
 
Distribute Key Value Store
Distribute Key Value StoreDistribute Key Value Store
Distribute Key Value Store
Santal Li
 

Similar to Dynamo: Not Just For Datastores (20)

Introduction to Cassandra: Replication and Consistency
Introduction to Cassandra: Replication and ConsistencyIntroduction to Cassandra: Replication and Consistency
Introduction to Cassandra: Replication and Consistency
 
Self healing data
Self healing dataSelf healing data
Self healing data
 
Introducing Riak
Introducing RiakIntroducing Riak
Introducing Riak
 
Introducing Riak
Introducing RiakIntroducing Riak
Introducing Riak
 
Handling Data in Mega Scale Web Systems
Handling Data in Mega Scale Web SystemsHandling Data in Mega Scale Web Systems
Handling Data in Mega Scale Web Systems
 
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
 
Analyzing Time-Series Data with Apache Spark and Cassandra - StampedeCon 2016
Analyzing Time-Series Data with Apache Spark and Cassandra - StampedeCon 2016Analyzing Time-Series Data with Apache Spark and Cassandra - StampedeCon 2016
Analyzing Time-Series Data with Apache Spark and Cassandra - StampedeCon 2016
 
Low Energy Task Scheduling based on Work Stealing
Low Energy Task Scheduling based on Work StealingLow Energy Task Scheduling based on Work Stealing
Low Energy Task Scheduling based on Work Stealing
 
Big Data & NoSQL - EFS'11 (Pavlo Baron)
Big Data & NoSQL - EFS'11 (Pavlo Baron)Big Data & NoSQL - EFS'11 (Pavlo Baron)
Big Data & NoSQL - EFS'11 (Pavlo Baron)
 
Lect 1.pptx
Lect 1.pptxLect 1.pptx
Lect 1.pptx
 
Gossip & Key Value Store
Gossip & Key Value StoreGossip & Key Value Store
Gossip & Key Value Store
 
Reactive programming with examples
Reactive programming with examplesReactive programming with examples
Reactive programming with examples
 
Reactive Qt - Ivan Čukić (Qt World Summit 2015)
Reactive Qt - Ivan Čukić (Qt World Summit 2015)Reactive Qt - Ivan Čukić (Qt World Summit 2015)
Reactive Qt - Ivan Čukić (Qt World Summit 2015)
 
REEF: Towards a Big Data Stdlib
REEF: Towards a Big Data StdlibREEF: Towards a Big Data Stdlib
REEF: Towards a Big Data Stdlib
 
Papers We Love / Kyiv : PAXOS (and little about other consensuses )
Papers We Love / Kyiv :  PAXOS (and little about other consensuses )Papers We Love / Kyiv :  PAXOS (and little about other consensuses )
Papers We Love / Kyiv : PAXOS (and little about other consensuses )
 
running stable diffusion on android
running stable diffusion on androidrunning stable diffusion on android
running stable diffusion on android
 
You need Event Mesh, not Service Mesh - Chris Suszynski [WJUG 301]
You need Event Mesh, not Service Mesh - Chris Suszynski [WJUG 301]You need Event Mesh, not Service Mesh - Chris Suszynski [WJUG 301]
You need Event Mesh, not Service Mesh - Chris Suszynski [WJUG 301]
 
Computational Techniques for the Statistical Analysis of Big Data in R
Computational Techniques for the Statistical Analysis of Big Data in RComputational Techniques for the Statistical Analysis of Big Data in R
Computational Techniques for the Statistical Analysis of Big Data in R
 
motor_2.ppt
motor_2.pptmotor_2.ppt
motor_2.ppt
 
Distribute Key Value Store
Distribute Key Value StoreDistribute Key Value Store
Distribute Key Value Store
 

More from Susan Potter

More from Susan Potter (6)

Thinking in Properties
Thinking in PropertiesThinking in Properties
Thinking in Properties
 
Champaign-Urbana Javascript Meetup Talk (Jan 2020)
Champaign-Urbana Javascript Meetup Talk (Jan 2020)Champaign-Urbana Javascript Meetup Talk (Jan 2020)
Champaign-Urbana Javascript Meetup Talk (Jan 2020)
 
From Zero to Haskell: Lessons Learned
From Zero to Haskell: Lessons LearnedFrom Zero to Haskell: Lessons Learned
From Zero to Haskell: Lessons Learned
 
Dynamically scaling a political news and activism hub (up to 5x the traffic i...
Dynamically scaling a political news and activism hub (up to 5x the traffic i...Dynamically scaling a political news and activism hub (up to 5x the traffic i...
Dynamically scaling a political news and activism hub (up to 5x the traffic i...
 
Twitter4R OAuth
Twitter4R OAuthTwitter4R OAuth
Twitter4R OAuth
 
Deploying distributed software services to the cloud without breaking a sweat
Deploying distributed software services to the cloud without breaking a sweatDeploying distributed software services to the cloud without breaking a sweat
Deploying distributed software services to the cloud without breaking a sweat
 

Recently uploaded

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
+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...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

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
 
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?
 
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
 
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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
+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...
 
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
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
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
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

Dynamo: Not Just For Datastores

  • 1. Dynamo: not just datastores Susan Potter September 2011
  • 2. Overview: In a nutshell Figure: "a highly available key-value storage system"
  • 3. Overview: Not for all apps
  • 4. Overview: Agenda Distribution & consistency Riak abstractions t - Fault tolerance Building an application N, R, W Considerations Dynamo techniques Oh, the possibilities!
  • 5. Distributed models & consistency Are you on ACID? Are your apps ACID? Few apps require strong consistency Embrace BASE for high availability
  • 6. Distributed models & consistency Are you on ACID? Are your apps ACID? Few apps require strong consistency Embrace BASE for high availability
  • 7. Distributed models & consistency Are you on ACID? Are your apps ACID? Few apps require strong consistency Embrace BASE for high availability
  • 8. Distributed models & consistency Are you on ACID? Are your apps ACID? Few apps require strong consistency Embrace BASE for high availability
  • 9. Distributed models & consistency BASE Basically Available Soft-state Eventual consistency
  • 10. Distributed models & consistency BASE Basically Available Soft-state Eventual consistency </RANT>
  • 11. t-Fault tolerance: Two kinds of failure
  • 12. t-Fault tolerance: More on failure Failstop fail in well understood / deterministic ways Byzantine fail in arbitrary non-deterministic ways
  • 13. t-Fault tolerance: More on failure Failstop fail in well understood / deterministic ways t-Fault tolerance means t + 1 nodes Byzantine fail in arbitrary non-deterministic ways
  • 14. t-Fault tolerance: More on failure Failstop fail in well understood / deterministic ways t-Fault tolerance means t + 1 nodes Byzantine fail in arbitrary non-deterministic ways
  • 15. t-Fault tolerance: More on failure Failstop fail in well understood / deterministic ways t-Fault tolerance means t + 1 nodes Byzantine fail in arbitrary non-deterministic ways t-Fault tolerance means 2t + 1 nodes
  • 16. CAP Controls: N, R, W N = number of replicas must be 1 ≤ N ≤ nodes R = number of responding read nodes can be set per request W = number of responding write nodes can be set per request Q = quorum "majority rules" set in stone: Q = N/2 + 1 Tunability when R = W = N =⇒ strong when R + W > N =⇒ quorum where W = 1, R = N or W = N, R = 1 or W = R = Q
  • 17. CAP Controls: N, R, W N = number of replicas must be 1 ≤ N ≤ nodes R = number of responding read nodes can be set per request W = number of responding write nodes can be set per request Q = quorum "majority rules" set in stone: Q = N/2 + 1 Tunability when R = W = N =⇒ strong when R + W > N =⇒ quorum where W = 1, R = N or W = N, R = 1 or W = R = Q
  • 18. CAP Controls: N, R, W N = number of replicas must be 1 ≤ N ≤ nodes R = number of responding read nodes can be set per request W = number of responding write nodes can be set per request Q = quorum "majority rules" set in stone: Q = N/2 + 1 Tunability when R = W = N =⇒ strong when R + W > N =⇒ quorum where W = 1, R = N or W = N, R = 1 or W = R = Q
  • 19. CAP Controls: N, R, W N = number of replicas must be 1 ≤ N ≤ nodes R = number of responding read nodes can be set per request W = number of responding write nodes can be set per request Q = quorum "majority rules" set in stone: Q = N/2 + 1 Tunability when R = W = N =⇒ strong when R + W > N =⇒ quorum where W = 1, R = N or W = N, R = 1 or W = R = Q
  • 20. CAP Controls: N, R, W N = number of replicas must be 1 ≤ N ≤ nodes R = number of responding read nodes can be set per request W = number of responding write nodes can be set per request Q = quorum "majority rules" set in stone: Q = N/2 + 1 Tunability when R = W = N =⇒ strong when R + W > N =⇒ quorum where W = 1, R = N or W = N, R = 1 or W = R = Q
  • 21. Dynamo: Properties Decentralized no masters exist Homogeneous nodes have same capabilities No Global State no SPOFs for global state Deterministic Replica Placement each node can calculate where replicas should exist for key Logical Time No reliance on physical time
  • 22. Dynamo: Properties Decentralized no masters exist Homogeneous nodes have same capabilities No Global State no SPOFs for global state Deterministic Replica Placement each node can calculate where replicas should exist for key Logical Time No reliance on physical time
  • 23. Dynamo: Properties Decentralized no masters exist Homogeneous nodes have same capabilities No Global State no SPOFs for global state Deterministic Replica Placement each node can calculate where replicas should exist for key Logical Time No reliance on physical time
  • 24. Dynamo: Properties Decentralized no masters exist Homogeneous nodes have same capabilities No Global State no SPOFs for global state Deterministic Replica Placement each node can calculate where replicas should exist for key Logical Time No reliance on physical time
  • 25. Dynamo: Properties Decentralized no masters exist Homogeneous nodes have same capabilities No Global State no SPOFs for global state Deterministic Replica Placement each node can calculate where replicas should exist for key Logical Time No reliance on physical time
  • 26. Dynamo: Techniques Consistent Hashing Vector Clocks Gossip Protocol Hinted Handoff
  • 27. Dynamo: Techniques Consistent Hashing Vector Clocks Gossip Protocol Hinted Handoff
  • 28. Dynamo: Consistent hashing Figure: PrefsList for K is [C, D, E]
  • 29. Dynamo: Vector clocks -type vclock() :: [{actor(), counter()}] A occurred-before B if counters in A are less than or equal to those in B for each actor
  • 30. Dynamo: Gossip protocol Figure: "You would never guess what I heard down the pub..."
  • 31. Dynamo: Hinted handoff Figure: "Here, take the baton and take over from me. KTHXBAI"
  • 32. riak_core: Abstractions Coordinator enforces consistency requirements, performing anti-entropy, gen_fsm, coordinates vnodes VNodes Erlang process, vnode to hashring partition, delegated work for its partition, unit of replication Watchers gen_event, listens for ring and service events, used to calculate fallback nodes Ring Manager stores local node copy of ring (and cluster?) data Ring Event Handlers notified about ring (and cluster?) changes and broadcasts plus metadata changes
  • 33. riak_core: Abstractions Coordinator enforces consistency requirements, performing anti-entropy, gen_fsm, coordinates vnodes VNodes Erlang process, vnode to hashring partition, delegated work for its partition, unit of replication Watchers gen_event, listens for ring and service events, used to calculate fallback nodes Ring Manager stores local node copy of ring (and cluster?) data Ring Event Handlers notified about ring (and cluster?) changes and broadcasts plus metadata changes
  • 34. riak_core: Abstractions Coordinator enforces consistency requirements, performing anti-entropy, gen_fsm, coordinates vnodes VNodes Erlang process, vnode to hashring partition, delegated work for its partition, unit of replication Watchers gen_event, listens for ring and service events, used to calculate fallback nodes Ring Manager stores local node copy of ring (and cluster?) data Ring Event Handlers notified about ring (and cluster?) changes and broadcasts plus metadata changes
  • 35. riak_core: Abstractions Coordinator enforces consistency requirements, performing anti-entropy, gen_fsm, coordinates vnodes VNodes Erlang process, vnode to hashring partition, delegated work for its partition, unit of replication Watchers gen_event, listens for ring and service events, used to calculate fallback nodes Ring Manager stores local node copy of ring (and cluster?) data Ring Event Handlers notified about ring (and cluster?) changes and broadcasts plus metadata changes
  • 36. riak_core: Abstractions Coordinator enforces consistency requirements, performing anti-entropy, gen_fsm, coordinates vnodes VNodes Erlang process, vnode to hashring partition, delegated work for its partition, unit of replication Watchers gen_event, listens for ring and service events, used to calculate fallback nodes Ring Manager stores local node copy of ring (and cluster?) data Ring Event Handlers notified about ring (and cluster?) changes and broadcasts plus metadata changes
  • 37. riak_core: Coordinator Figure: Header of a coordinator
  • 38. riak_core: Commands -type riak_cmd() :: {verb(), key(), payload()} Implement handle_command/3 clause for each command in your callback VNode module
  • 40. riak_core: VNodes Figure: Sample handoff functions from RTS example app
  • 41. riak_core: Project Structure rebar ;) also written by the Basho team, makes OTP building and deploying much less painful dependencies add you_app, riak_core, riak_kv, etc. as dependencies to shell project new in 1.0 stuff cluster vs ring membership, riak_pipe, etc.
  • 42. riak_core: Project Structure rebar ;) also written by the Basho team, makes OTP building and deploying much less painful dependencies add you_app, riak_core, riak_kv, etc. as dependencies to shell project new in 1.0 stuff cluster vs ring membership, riak_pipe, etc.
  • 43. riak_core: Project Structure rebar ;) also written by the Basho team, makes OTP building and deploying much less painful dependencies add you_app, riak_core, riak_kv, etc. as dependencies to shell project new in 1.0 stuff cluster vs ring membership, riak_pipe, etc.
  • 44. Considerations Other:stuff() Interface layer riak_core apps need to implement their own interface layer, e.g. HTTP, XMPP, AMQP, MsgPack, ProtoBuffers Securing application riak_core gossip does not address identity/authZ/authN between nodes; relies on Erlang cookies Distribution models e.g. pipelined, laned vs tiered Query/execution models e.g. map-reduce (M/R), ASsociated SET (ASSET)
  • 45. Considerations Other:stuff() Interface layer riak_core apps need to implement their own interface layer, e.g. HTTP, XMPP, AMQP, MsgPack, ProtoBuffers Securing application riak_core gossip does not address identity/authZ/authN between nodes; relies on Erlang cookies Distribution models e.g. pipelined, laned vs tiered Query/execution models e.g. map-reduce (M/R), ASsociated SET (ASSET)
  • 46. Considerations Other:stuff() Interface layer riak_core apps need to implement their own interface layer, e.g. HTTP, XMPP, AMQP, MsgPack, ProtoBuffers Securing application riak_core gossip does not address identity/authZ/authN between nodes; relies on Erlang cookies Distribution models e.g. pipelined, laned vs tiered Query/execution models e.g. map-reduce (M/R), ASsociated SET (ASSET)
  • 47. Considerations Other:stuff() Interface layer riak_core apps need to implement their own interface layer, e.g. HTTP, XMPP, AMQP, MsgPack, ProtoBuffers Securing application riak_core gossip does not address identity/authZ/authN between nodes; relies on Erlang cookies Distribution models e.g. pipelined, laned vs tiered Query/execution models e.g. map-reduce (M/R), ASsociated SET (ASSET)
  • 48. Oh, the possibilities! What:next() Concurrency models e.g. actor, disruptor, evented/reactor, threading Consistency models e.g. vector-field, causal, FIFO Computation optimizations e.g. General Purpose GPU programming, native interfacing (NIFs, JInterface, Scalang?) Other optimizations e.g. Client discovery, Remote Direct Memory Access (RDMA)
  • 49. Oh, the possibilities! What:next() Concurrency models e.g. actor, disruptor, evented/reactor, threading Consistency models e.g. vector-field, causal, FIFO Computation optimizations e.g. General Purpose GPU programming, native interfacing (NIFs, JInterface, Scalang?) Other optimizations e.g. Client discovery, Remote Direct Memory Access (RDMA)
  • 50. Oh, the possibilities! What:next() Concurrency models e.g. actor, disruptor, evented/reactor, threading Consistency models e.g. vector-field, causal, FIFO Computation optimizations e.g. General Purpose GPU programming, native interfacing (NIFs, JInterface, Scalang?) Other optimizations e.g. Client discovery, Remote Direct Memory Access (RDMA)
  • 51. Oh, the possibilities! What:next() Concurrency models e.g. actor, disruptor, evented/reactor, threading Consistency models e.g. vector-field, causal, FIFO Computation optimizations e.g. General Purpose GPU programming, native interfacing (NIFs, JInterface, Scalang?) Other optimizations e.g. Client discovery, Remote Direct Memory Access (RDMA)
  • 52. # finger $(whoami) Login: susan Name: Susan Potter Directory: /home/susan Shell: /bin/zsh On since Mon 29 Sep 1997 21:18 (GMT) on tty1 from :0 Too much unread mail on me@susanpotter.net Now working at Assistly! Looking for smart developers!;) Plan: github: mbbx6spp twitter: @SusanPotter
  • 53. Slides & Material https://github.com/mbbx6spp/riak_core-templates Figure: http://susanpotter.net/talks/strange-loop/2011/dynamo-not-just-for-datastores/
  • 54. Examples Rebar Templates https://github.com/mbbx6spp/riak_core-templates Riak Pipes https://github.com/basho/riak_pipe Riak Zab https://github.com/jtuple/riak_zab
  • 55. Questions? Figure: http://www.flickr.com/photos/42682395@N04/ @SusanPotter
  • 56. Questions? Figure: http://www.flickr.com/photos/42682395@N04/ @SusanPotter