Slide 1

Slide 1 text

Riak Intro

Slide 2

Slide 2 text

•  Shanley Kane @shanley [email protected] •  Mark Phillips @pharkmillups [email protected] Us

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

What`s in store? •  At a High Level •  For Developers •  Under the Hood •  When and Why •  Some Users •  Commercial Extensions •  1.2 and Roadmap

Slide 5

Slide 5 text

At a High Level

Slide 6

Slide 6 text

•  Dynamo-inspired key/value store •  with some extras: search, MapReduce, 2i, links, pre- and post-commit hooks, pluggable backends, HTTP and binary interfaces •  Written in Erlang with C/C++ •  Open source under Apache 2 License Riak

Slide 7

Slide 7 text

Riak’s Design Goals (1) •  High-availability •  Low-latency •  Horizontal Scalability •  Fault Tolerance •  Ops Friendliness •  Predictability

Slide 8

Slide 8 text

Riak’s Design Goals (2) •  Design Informed by Brewer’s CAP Theorem and Amazon’s Dynamo Paper •  Riak is tuned to offer availability above all else •  Developers can tune for consistency (more on this later)

Slide 9

Slide 9 text

Masterless; deployed as a cluster of nodes

Slide 10

Slide 10 text

For Developers

Slide 11

Slide 11 text

Riak is a database that stores keys against values. Keys are grouped into a higher-level namespace called buckets.

Slide 12

Slide 12 text

Riak doesn’t care what you store. It will accept any data type; things are stored on disk as binaries.

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

Two APIs 1.  HTTP (just like the web) 2.  Protocol Buffers (thank you, Google)

Slide 18

Slide 18 text

Querying GET/PUT/DELETE MapReduce Full-Text Search Secondary Indexes (2i)

Slide 19

Slide 19 text

Tunable Consistency •  n_val - number of replica to store; bucket- level setting. Defaults to “3”. •  w - number of replicas required for a successful write; Defaults to “2”. •  r - number of replica acks required for a successful read. request-level setting. Defaults to “2”. •  Tweak consistency vs. availability

Slide 20

Slide 20 text

Client Libraries Ruby, Node.js, Java, Python, Perl, OCaml, Erlang, PHP, C, Squeak, Smalltalk, Pharoah, Clojure, Scala, Haskell, Lisp, Go, .NET, Play, and more (supported by either Basho or the community).

Slide 21

Slide 21 text

Under the Hood

Slide 22

Slide 22 text

Consistent Hashing and Replicas Virtual Nodes Vector Clocks Gossiping Handoff and Rebalancing

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

Virtual Nodes •  Each physical machine runs a certain number of Vnodes •  Unit of addressing, concurrency in Riak •  Storage not tied to physical assets •  Enables dynamic rebalancing of data when cluster topology changes

Slide 35

Slide 35 text

Vector Clocks •  Data structure used to reason about causality at the object level •  Provides happened-before relationship between events •  Each object in Riak has a vector clock* •  Trade off space, speed, complexity for safety

Slide 36

Slide 36 text

Handoff and Rebalancing •  When cluster topology changes, data must be rebalanced •  Handoff and rebalancing happen in the background; no manual intervention required* •  Trade off speed of convergence vs. effects on cluster performance

Slide 37

Slide 37 text

Gossip Protocol •  Nodes “gossip” their view of cluster state •  Enables nodes to store minimal cluster state •  Can lead to network chatiness; in OTP, all nodes are fully-connected

Slide 38

Slide 38 text

Riak: when and why

Slide 39

Slide 39 text

When Might Riak Make Sense When you have enough data to require >1 physical machine (preferably >5) When availability is more important than consistency (think “critical data”on “big data”) When your data can be modeled as keys and values; don’t be afraid to denormalize

Slide 40

Slide 40 text

User/MetaData Store •  User profile storage for xfinityTV Mobile app •  Storage of metadata on content providers and licensing •  Strict Latency requirements

Slide 41

Slide 41 text

Notifications

Slide 42

Slide 42 text

Session Storage •  First Basho customer in 2009 •  Every hit to a Mochi web property results in at least one read, maybe write to Riak •  Unavailability or high latency = lost ad revenue

Slide 43

Slide 43 text

Ad Serving •  OpenX will serve ~4T ad in 2012 •  Started with CouchDB and Cassandra for various parts of infrastructure •  Now consolidating on Riak and Riak Core

Slide 44

Slide 44 text

Riak for All Storage: Voxer

Slide 45

Slide 45 text

Voxer: Initial Stats •  11 Riak nodes (switched from CouchDB) •  100s of GBs •  ~20k Peak Concurrent Users •  ~4MM Daily Request

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

Voxer: Post Growth •  ~60 Nodes total in prod •  100s of TBs of data (>1TB daily) •  ~400k Concurrent Users •  Billions of daily Requests

Slide 48

Slide 48 text

Riak : Hybrid Solutions •  Riak with Postgres •  Riak with Elastic Search •  Riak with Hadoop •  Secondary analytics clusters

Slide 49

Slide 49 text

Buy Some Software...

Slide 50

Slide 50 text

Riak Enterprise •  Multi-data center replication •  Real-time or full-time sync

Slide 51

Slide 51 text

Riak Enterprise: Full Sync

Slide 52

Slide 52 text

Riak Enterprise: Real-Time Sync

Slide 53

Slide 53 text

Riak Cloud Storage •  Large object support •  S3-compatible API •  Multi-tenancy •  Reporting on usage

Slide 54

Slide 54 text

Roadmap Stuff...

Slide 55

Slide 55 text

New in Riak 1.2 •  LevelDB Improvements •  FreeBSD Support •  New Cluster Admin Tools •  Folsom for Stats •  KV and Search Repair work •  Much much more

Slide 56

Slide 56 text

Future Work •  Active Anti Entropy •  CRDTs •  Tight Solr integration •  Greater consistency •  Lots of other hotness

Slide 57

Slide 57 text

•  docs.basho.com •  @basho •  github.com/basho Riak