SlideShare a Scribd company logo
Riak Use Cases:
         Dissecting the Solutions to
         Hard Problems
         Andy Gross <@argv0>
         Principal Architect, Basho Technologies
         QCon SF 2011




Wednesday, November 16, 11
Riak
              Dynamo-inspired key value database
                   with full text search, map/reduce, secondary indices,
                   link traversal, commit hooks, HTTP and binary
                   interfaces
              Written in Erlang (and C/C++)
              Open Source, Apache 2 licensed
              Enterprise features (multi-datacenter replication) and
              support available from Basho


Wednesday, November 16, 11
Choosing a NoSQL
         Database

              At small scale, everything works.
              NoSQL DBs trade off traditional features to better
              support new and emerging use cases
              Knowledge of the underlying system is essential
              NoSQL marketing is... “confusing”




Wednesday, November 16, 11
Tradeoffs

              If you’re evaluating Mongo vs. Riak, or Couch vs.
              Cassandra, you don’t understand your problem
              By choosing Riak, you’ve already made tradeoffs:
                   Sacrificing consistency for availability in failure
                   scenarios
                   A rich data/query model for a simple, scalable one



Wednesday, November 16, 11
Distributed Systems:
         Desirable Properties
              Highly Available   Fault Tolerant
              Low Latency        Ops-Friendly
              Scalable           Predictable




Wednesday, November 16, 11
Medical Records Store
         Danish Health Authorities
              Implemented by Trifork A/S
              Won the Digitization Prize as one of the “best
              government IT projects in Denmark”
              Stores medical prescription history for all
              Danish Citizens, replicated in 2 data centers.
              Accessed from pharmacies, hospital, mobile
              devices
              Replicated in multiple data centers


Wednesday, November 16, 11
User/Metadata Store
         Comcast

              User profile storage for xfinityTV mobile
              application
              Storage of metadata on content providers, and
              content licensing info
              Strict latency requirements




Wednesday, November 16, 11
Notification Service
         Yammer




Wednesday, November 16, 11
Session Store
         Mochi Media

              First Basho Customer (late 2009)
              Every hit to a Mochi web property = 1 read,
              maybe one write to Riak
              Unavailability, high latency = lost ad revenue




Wednesday, November 16, 11
Document Store
         Github Pages / Git.io

              Riak as a web server for Github Pages (in
              staging)
              Webmachine is an awesome HTTP server!
              Git.io URL shortener




Wednesday, November 16, 11
Distributed Systems:
         Desirable Properties
              High Availability        Fault Tolerance
              Low Latency              Ops-Friendliness
              Horizontal Scalability   Predictability




Wednesday, November 16, 11
High Availability

              Failure to accept a read/write results in:
                   lost revenue
                   lost users
              Availability and latency are intertwined




Wednesday, November 16, 11
Low Latency

           Sometimes late answer is useless or wrong
           Users perceive slow sites as unavailable
           SLA violations
           SOA approaches magnify SLA failures




Wednesday, November 16, 11
Fault Tolerance
              Everything fails
                   Especially in the cloud
              When a host/disk/network fails, what is the impact on
                   Availability
                   Latency
                   Operations staff



Wednesday, November 16, 11
Predictability

                       “It’s a piece of plumbing; it has never been
                       a root cause of any of our problems.”

                       Coda Hale, Yammer




Wednesday, November 16, 11
Cost




Wednesday, November 16, 11
Operational Costs
              Sound familiar?
                   “we chose a bad shard key...”
                   “the failover script did not run as expected...”
                   “the root cause was traced to a configuration
                   error...”
              Staying up all night fighting your database does
              not make you a hero.



Wednesday, November 16, 11
High Availability:
         Erlang

              Ericcson AXD-301: 99.9999999% uptime (31ms/year)
              Shared-nothing, immutable, message-passing,
              functional, concurrent
              Distributed systems primitives in core language
              OTP (Open Telecom Platform)




Wednesday, November 16, 11
High Availability:
         Riak Core

              Dynamo abstracted: distributed systems toolkit
              Exhaustively tested
              In production use at AOL, Yahoo, others
              Insulates local storage and client API code from the
              hard problems




Wednesday, November 16, 11
Low Latency:
         Bitcask
             Low Latency: All reads = hash lookup + 1 seek
                                  After the append completes, an in-memory structure called a ”keydir” is updated. A keydir is simply a hash
                               table that maps every key in a Bitcask to a fixed-size structure giving the file, offset, and size of the most recently
                               written entry for that key.




                                   When a write occurs, the keydir is atomically updated with the location of the newest data. The old data is
                               still present on disk, but any new reads will use the latest version available in the keydir. As we’ll see later, the

                             Tradeoff: Index must fit in memory
                               merge process will eventually remove the old value.
                                   Reading a value is simple, and doesn’t ever require more than a single disk seek. We look up the key in our
                               keydir, and from there we read the data using the file id, position, and size that are returned from that lookup. In
                               many cases, the operating system’s filesystem read-ahead cache makes this a much faster operation than would
                               be otherwise expected.
Wednesday, November 16, 11
Wednesday, November 16, 11
Low Latency:
         Erlang VM

              Erlang VM was designed for soft-realtime apps
                   Preemptively scheduled lightweight threads
                   GC is per-thread, not stop-the-world
              Sophisticated scheduler + message passing = effective
              use of multicore machines.




Wednesday, November 16, 11
Wednesday, November 16, 11
Questions?




Wednesday, November 16, 11

More Related Content

What's hot (13)

PDF
soft-shake.ch - Data grids and Data Caching
soft-shake.ch
 
PDF
Docker 101 for Oracle DBAs - Oracle OpenWorld 2017
Adeesh Fulay
 
PPTX
Paul Dix [InfluxData] | InfluxDays Opening Keynote | InfluxDays Virtual Exper...
InfluxData
 
PDF
Codemotion 2015 Infinispan Tech lab
Ugo Landini
 
PDF
CockroachDB: Architecture of a Geo-Distributed SQL Database
C4Media
 
PPTX
{code} and Containers - Open Source Infrastructure within Dell Technologies
The {code} Team
 
PDF
NoSQL overview implementation free
Benoit Perroud
 
PDF
Designing for Massive Scalability at BackType #bigdatacamp
Michael Montano
 
PDF
The Hows and Whys of a Distributed SQL Database - Strange Loop 2017
Alex Robinson
 
PDF
keyvi the key value index @ Cliqz
Hendrik Muhs
 
PDF
D conf 2016 - Using D for Primary Storage
Liran Zvibel
 
PDF
Containers in depth – Understanding how containers work to better work with c...
All Things Open
 
PDF
Microservices and Cloud Native Apps Meetup with Diamanti and Nirmata
Fred Love
 
soft-shake.ch - Data grids and Data Caching
soft-shake.ch
 
Docker 101 for Oracle DBAs - Oracle OpenWorld 2017
Adeesh Fulay
 
Paul Dix [InfluxData] | InfluxDays Opening Keynote | InfluxDays Virtual Exper...
InfluxData
 
Codemotion 2015 Infinispan Tech lab
Ugo Landini
 
CockroachDB: Architecture of a Geo-Distributed SQL Database
C4Media
 
{code} and Containers - Open Source Infrastructure within Dell Technologies
The {code} Team
 
NoSQL overview implementation free
Benoit Perroud
 
Designing for Massive Scalability at BackType #bigdatacamp
Michael Montano
 
The Hows and Whys of a Distributed SQL Database - Strange Loop 2017
Alex Robinson
 
keyvi the key value index @ Cliqz
Hendrik Muhs
 
D conf 2016 - Using D for Primary Storage
Liran Zvibel
 
Containers in depth – Understanding how containers work to better work with c...
All Things Open
 
Microservices and Cloud Native Apps Meetup with Diamanti and Nirmata
Fred Love
 

Viewers also liked (20)

PPTX
Riak add presentation
Ilya Bogunov
 
PDF
Building Distributed Systems With Riak and Riak Core
Andy Gross
 
PDF
Scaling with Riak at Showyou
John Muellerleile
 
PDF
Redis : Play buzz uses Redis
Redis Labs
 
PDF
Modelling Data as Graphs (Neo4j)
Michal Bachman
 
PDF
An intro to Neo4j and some use cases (JFokus 2011)
Emil Eifrem
 
PDF
Recommendations with Neo4j (FOSDEM 2015)
Michal Bachman
 
PPT
Redis use cases
Bottom Wang
 
PDF
Advanced Neo4j Use Cases with the GraphAware Framework
Michal Bachman
 
PDF
Modelling Data in Neo4j (plus a few tips)
Michal Bachman
 
PDF
Best Buy Web 2.0
Lee Aase
 
PPTX
Introduction to Redis Data Structures: Sorted Sets
ScaleGrid.io
 
PDF
Redis and its many use cases
Christian Joudrey
 
PDF
Introduction to some top Redis use cases
Josiah Carlson
 
PPTX
The BestBuy.com Cloud Architecture
joelcrabb
 
PDF
Using Redis at Facebook
Redis Labs
 
PDF
Bootstrapping Recommendations with Neo4j
Max De Marzi
 
PPTX
Neo4j GraphTalks - Einführung in Graphdatenbanken
Neo4j
 
PPTX
Redis Use Patterns (DevconTLV June 2014)
Itamar Haber
 
PDF
Neo4j the Anti Crime Database
Neo4j
 
Riak add presentation
Ilya Bogunov
 
Building Distributed Systems With Riak and Riak Core
Andy Gross
 
Scaling with Riak at Showyou
John Muellerleile
 
Redis : Play buzz uses Redis
Redis Labs
 
Modelling Data as Graphs (Neo4j)
Michal Bachman
 
An intro to Neo4j and some use cases (JFokus 2011)
Emil Eifrem
 
Recommendations with Neo4j (FOSDEM 2015)
Michal Bachman
 
Redis use cases
Bottom Wang
 
Advanced Neo4j Use Cases with the GraphAware Framework
Michal Bachman
 
Modelling Data in Neo4j (plus a few tips)
Michal Bachman
 
Best Buy Web 2.0
Lee Aase
 
Introduction to Redis Data Structures: Sorted Sets
ScaleGrid.io
 
Redis and its many use cases
Christian Joudrey
 
Introduction to some top Redis use cases
Josiah Carlson
 
The BestBuy.com Cloud Architecture
joelcrabb
 
Using Redis at Facebook
Redis Labs
 
Bootstrapping Recommendations with Neo4j
Max De Marzi
 
Neo4j GraphTalks - Einführung in Graphdatenbanken
Neo4j
 
Redis Use Patterns (DevconTLV June 2014)
Itamar Haber
 
Neo4j the Anti Crime Database
Neo4j
 
Ad

Similar to Riak Use Cases : Dissecting The Solutions To Hard Problems (20)

PDF
Infinispan for Dummies
Galder Zamarreño
 
PDF
Data Grids and Data Caching
Galder Zamarreño
 
PPTX
Distributed file systems chapter 9
Alagappa Government Arts College, Karaikudi
 
PPTX
Dos unit 4
JebasheelaSJ
 
PDF
Apache Hadoop Talk at QCon
Cloudera, Inc.
 
PDF
Practical Problem Solving with Apache Hadoop & Pig
Milind Bhandarkar
 
PDF
Introducing Riak and Ripple
Sean Cribbs
 
PDF
Non-Relational Databases & Key/Value Stores
Joël Perras
 
PDF
Abstractions at Scale – Our Experiences at Twitter
Leonidas Tsementzis
 
PPT
Chapter 17 - Distributed File Systems
Wayne Jones Jnr
 
PDF
Riak intro to..
Adron Hall
 
PDF
Membase Meetup - San Diego
Membase
 
PPT
Ch16 OS
C.U
 
PPT
OSCh16
Joe Christensen
 
PDF
Databases and the Cloud
Henrik Ingo
 
PDF
Availability, the Cloud and Everything
logicalstack
 
PDF
Distributed Data processing in a Cloud
elliando dias
 
PDF
Data Grids vs Databases
Galder Zamarreño
 
PPT
Borthakur hadoop univ-research
saintdevil163
 
Infinispan for Dummies
Galder Zamarreño
 
Data Grids and Data Caching
Galder Zamarreño
 
Distributed file systems chapter 9
Alagappa Government Arts College, Karaikudi
 
Dos unit 4
JebasheelaSJ
 
Apache Hadoop Talk at QCon
Cloudera, Inc.
 
Practical Problem Solving with Apache Hadoop & Pig
Milind Bhandarkar
 
Introducing Riak and Ripple
Sean Cribbs
 
Non-Relational Databases & Key/Value Stores
Joël Perras
 
Abstractions at Scale – Our Experiences at Twitter
Leonidas Tsementzis
 
Chapter 17 - Distributed File Systems
Wayne Jones Jnr
 
Riak intro to..
Adron Hall
 
Membase Meetup - San Diego
Membase
 
Ch16 OS
C.U
 
Databases and the Cloud
Henrik Ingo
 
Availability, the Cloud and Everything
logicalstack
 
Distributed Data processing in a Cloud
elliando dias
 
Data Grids vs Databases
Galder Zamarreño
 
Borthakur hadoop univ-research
saintdevil163
 
Ad

Recently uploaded (20)

PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
Advancing WebDriver BiDi support in WebKit
Igalia
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
Advancing WebDriver BiDi support in WebKit
Igalia
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 

Riak Use Cases : Dissecting The Solutions To Hard Problems

  • 1. Riak Use Cases: Dissecting the Solutions to Hard Problems Andy Gross <@argv0> Principal Architect, Basho Technologies QCon SF 2011 Wednesday, November 16, 11
  • 2. Riak Dynamo-inspired key value database with full text search, map/reduce, secondary indices, link traversal, commit hooks, HTTP and binary interfaces Written in Erlang (and C/C++) Open Source, Apache 2 licensed Enterprise features (multi-datacenter replication) and support available from Basho Wednesday, November 16, 11
  • 3. Choosing a NoSQL Database At small scale, everything works. NoSQL DBs trade off traditional features to better support new and emerging use cases Knowledge of the underlying system is essential NoSQL marketing is... “confusing” Wednesday, November 16, 11
  • 4. Tradeoffs If you’re evaluating Mongo vs. Riak, or Couch vs. Cassandra, you don’t understand your problem By choosing Riak, you’ve already made tradeoffs: Sacrificing consistency for availability in failure scenarios A rich data/query model for a simple, scalable one Wednesday, November 16, 11
  • 5. Distributed Systems: Desirable Properties Highly Available Fault Tolerant Low Latency Ops-Friendly Scalable Predictable Wednesday, November 16, 11
  • 6. Medical Records Store Danish Health Authorities Implemented by Trifork A/S Won the Digitization Prize as one of the “best government IT projects in Denmark” Stores medical prescription history for all Danish Citizens, replicated in 2 data centers. Accessed from pharmacies, hospital, mobile devices Replicated in multiple data centers Wednesday, November 16, 11
  • 7. User/Metadata Store Comcast User profile storage for xfinityTV mobile application Storage of metadata on content providers, and content licensing info Strict latency requirements Wednesday, November 16, 11
  • 8. Notification Service Yammer Wednesday, November 16, 11
  • 9. Session Store Mochi Media First Basho Customer (late 2009) Every hit to a Mochi web property = 1 read, maybe one write to Riak Unavailability, high latency = lost ad revenue Wednesday, November 16, 11
  • 10. Document Store Github Pages / Git.io Riak as a web server for Github Pages (in staging) Webmachine is an awesome HTTP server! Git.io URL shortener Wednesday, November 16, 11
  • 11. Distributed Systems: Desirable Properties High Availability Fault Tolerance Low Latency Ops-Friendliness Horizontal Scalability Predictability Wednesday, November 16, 11
  • 12. High Availability Failure to accept a read/write results in: lost revenue lost users Availability and latency are intertwined Wednesday, November 16, 11
  • 13. Low Latency Sometimes late answer is useless or wrong Users perceive slow sites as unavailable SLA violations SOA approaches magnify SLA failures Wednesday, November 16, 11
  • 14. Fault Tolerance Everything fails Especially in the cloud When a host/disk/network fails, what is the impact on Availability Latency Operations staff Wednesday, November 16, 11
  • 15. Predictability “It’s a piece of plumbing; it has never been a root cause of any of our problems.” Coda Hale, Yammer Wednesday, November 16, 11
  • 17. Operational Costs Sound familiar? “we chose a bad shard key...” “the failover script did not run as expected...” “the root cause was traced to a configuration error...” Staying up all night fighting your database does not make you a hero. Wednesday, November 16, 11
  • 18. High Availability: Erlang Ericcson AXD-301: 99.9999999% uptime (31ms/year) Shared-nothing, immutable, message-passing, functional, concurrent Distributed systems primitives in core language OTP (Open Telecom Platform) Wednesday, November 16, 11
  • 19. High Availability: Riak Core Dynamo abstracted: distributed systems toolkit Exhaustively tested In production use at AOL, Yahoo, others Insulates local storage and client API code from the hard problems Wednesday, November 16, 11
  • 20. Low Latency: Bitcask Low Latency: All reads = hash lookup + 1 seek After the append completes, an in-memory structure called a ”keydir” is updated. A keydir is simply a hash table that maps every key in a Bitcask to a fixed-size structure giving the file, offset, and size of the most recently written entry for that key. When a write occurs, the keydir is atomically updated with the location of the newest data. The old data is still present on disk, but any new reads will use the latest version available in the keydir. As we’ll see later, the Tradeoff: Index must fit in memory merge process will eventually remove the old value. Reading a value is simple, and doesn’t ever require more than a single disk seek. We look up the key in our keydir, and from there we read the data using the file id, position, and size that are returned from that lookup. In many cases, the operating system’s filesystem read-ahead cache makes this a much faster operation than would be otherwise expected. Wednesday, November 16, 11
  • 22. Low Latency: Erlang VM Erlang VM was designed for soft-realtime apps Preemptively scheduled lightweight threads GC is per-thread, not stop-the-world Sophisticated scheduler + message passing = effective use of multicore machines. Wednesday, November 16, 11