Slide 1

Slide 1 text

Learn You Some Riak

Slide 2

Slide 2 text

@wfarr github.com/wfarr

Slide 3

Slide 3 text

Learn You Some Riak

Slide 4

Slide 4 text

Story Time

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

TL; DR

Slide 7

Slide 7 text

TL; DR Disclaimer: You should totally read this paper as soon as you get home and bask in its glory.

Slide 8

Slide 8 text

Dynamo

Slide 9

Slide 9 text

Buckets, Keys, Values

Slide 10

Slide 10 text

Fault- Tolerant

Slide 11

Slide 11 text

Masterless

Slide 12

Slide 12 text

What is this magic?

Slide 13

Slide 13 text

CAP Theorem

Slide 14

Slide 14 text

Consistency

Slide 15

Slide 15 text

All Nodes See Data at the Same Time

Slide 16

Slide 16 text

Availability

Slide 17

Slide 17 text

Every DB Request Gets a Response for Success or Failure, Guaranteed

Slide 18

Slide 18 text

Partition Tolerance

Slide 19

Slide 19 text

Your DB keeps working despite arbitrary message loss or failure of a part of the system

Slide 20

Slide 20 text

All Good for Different Things

Slide 21

Slide 21 text

You Only Get To Have 2 of the 3

Slide 22

Slide 22 text

Dynamo Chooses Availability and Partition Tolerance

Slide 23

Slide 23 text

What is Riak?

Slide 24

Slide 24 text

Riak is a Dynamo

Slide 25

Slide 25 text

Bucket- Key: Value

Slide 26

Slide 26 text

Entries abc object bcd object cde object def object Logs abc object bcd object cde object def object

Slide 27

Slide 27 text

The Ring

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

VNodes

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

Querying

Slide 32

Slide 32 text

Map Reduce

Slide 33

Slide 33 text

Riak::MapReduce.new(client)

Slide 34

Slide 34 text

mr.filter("tweets") do matches "^testeroftests-" end

Slide 35

Slide 35 text

fn = "function (v) { return [ JSON.parse(v.values[0].data).text ]; }"

Slide 36

Slide 36 text

mr.map(fn, :keep => true)

Slide 37

Slide 37 text

mr.run

Slide 38

Slide 38 text

Search

Slide 39

Slide 39 text

Full-text Search

Slide 40

Slide 40 text

Lucene Syntax

Slide 41

Slide 41 text

client.search "tweets", "retweeted:true"

Slide 42

Slide 42 text

Supports Manual Indexing

Slide 43

Slide 43 text

client.index "tweets", { id: "abcde", text: "#webscale" }

Slide 44

Slide 44 text

Supports Auto Indexing

Slide 45

Slide 45 text

t = client[‘tweets’] t.is_indexed? t.enable_index! t.disable_index!

Slide 46

Slide 46 text

Queries Nodes Intelligently

Slide 47

Slide 47 text

Tradeoffs

Slide 48

Slide 48 text

Consistency Availability Partition Tolerance

Slide 49

Slide 49 text

Consistency Availability Partition Tolerance

Slide 50

Slide 50 text

The Good

Slide 51

Slide 51 text

Riak gets to be masterless

Slide 52

Slide 52 text

Riak gets to be fault-tolerant

Slide 53

Slide 53 text

Riak gets to be easy to scale

Slide 54

Slide 54 text

Riak gets to be easy to manage

Slide 55

Slide 55 text

The Bad

Slide 56

Slide 56 text

Riak is “only” eventually consistent

Slide 57

Slide 57 text

Understand Your Tradeoffs

Slide 58

Slide 58 text

Your Tradeoffs Might Not Be Someone Else’s

Slide 59

Slide 59 text

There is no silver bullet

Slide 60

Slide 60 text

No content

Slide 61

Slide 61 text

“The most boring database you’ll ever run in production.” @pharkmillups

Slide 62

Slide 62 text

Boring Makes Devs Happy

Slide 63

Slide 63 text

Boring Makes Ops Happy

Slide 64

Slide 64 text

Boring is Awesome

Slide 65

Slide 65 text

Devs Ops

Slide 66

Slide 66 text

Ops Devs

Slide 67

Slide 67 text

Example Use Cases

Slide 68

Slide 68 text

Session Storage

Slide 69

Slide 69 text

Private S3-like Storage

Slide 70

Slide 70 text

Huge Amounts of Rich Media

Slide 71

Slide 71 text

Caching Layer

Slide 72

Slide 72 text

Simple Horizontal Scaling

Slide 73

Slide 73 text

Logging Systems

Slide 74

Slide 74 text

Maybe Not Use Cases

Slide 75

Slide 75 text

Realtime

Slide 76

Slide 76 text

Replacing Stuff That Isn’t Broken

Slide 77

Slide 77 text

You Can Use Multiple Databases!

Slide 78

Slide 78 text

Who Already Uses Riak?

Slide 79

Slide 79 text

No content

Slide 80

Slide 80 text

No content

Slide 81

Slide 81 text

Demo

Slide 82

Slide 82 text

Let’s Pretend...

Slide 83

Slide 83 text

No content

Slide 84

Slide 84 text

Single Server

Slide 85

Slide 85 text

Nope

Slide 86

Slide 86 text

Sharding

Slide 87

Slide 87 text

Nope

Slide 88

Slide 88 text

“building a distributed system ass first” @jnewland

Slide 89

Slide 89 text

Go Horizontal

Slide 90

Slide 90 text

No content

Slide 91

Slide 91 text

Madness?

Slide 92

Slide 92 text

Nope just big data

Slide 93

Slide 93 text

Scenario

Slide 94

Slide 94 text

Questions?

Slide 95

Slide 95 text

Thanks! Will Farrington speakerdeck.com/u/wfarr github.com/wfarr/tweetscale