riak intro

Post on 04-Jul-2015

1.328 Views

Category:

Technology

5 Downloads

Preview:

Click to see full reader

DESCRIPTION

This slide deck was delivered

TRANSCRIPT

Jon Meredith Basho Technologies

Tuesday, December 7, 2010

WHAT IS IT?

Tuesday, December 7, 2010

basho

Riak is a scalable, highly-available, networked

key/value store.

Tuesday, December 7, 2010

basho

Inspired by Amazon’s Dynamo...with some enhancements.

Open Source

Tuesday, December 7, 2010

Riak is a scalable, highly-available, networked

key/value store.

Tuesday, December 7, 2010

basho

•Stores and retrieves data against a key.

•Encode your data how you like it.

•Keys are organized into buckets.

Tuesday, December 7, 2010

basho

BASIC OPERATIONS

getput

delete

Tuesday, December 7, 2010

basho

•Riak also stores metadata against keys

•Content Type, Charset, Encoding, ...

•Custom application metadata

Tuesday, December 7, 2010

basho

Riak is a scalable, highly-available, networked

key/value store.

Tuesday, December 7, 2010

basho

bucket: pivotalkey: greetingvalue: “<h1>Hi Pivotal<h1>” metadata: content-type=text/html charset=utf8

Tuesday, December 7, 2010

basho

> PUT /riak/pivotal/greeting HTTP/1.1> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8l zlib/1.2.3> Host: 127.0.0.1:8098> Accept: */*> content-type: text/html> charset: utf8> Content-Length: 19> > <h1>Hi Pivotal<h1>

< HTTP/1.1 200 OK< X-Riak-Vclock: a85hYGBgzWDKBVIsTNPiOTOYEhnzWBm+5uUf5YMIszUnMdcLv4dKsOTDJVhYPx1JwiLMeH/bU6iwWj6yMUwtt6yQJbIA< Vary: Accept-Encoding< Server: MochiWeb/1.1 WebMachine/1.6 (eat around the stinger)< Link: </riak/pivotal>; rel="up"< Date: Mon, 24 May 2010 21:44:06 GMT< Content-Type: text/html< Content-Length: 19<

Tuesday, December 7, 2010

basho

> GET /riak/pivotal/greeting HTTP/1.1> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8l zlib/1.2.3> Host: localhost:8098> Accept: */*> < HTTP/1.1 200 OK< X-Riak-Vclock: a85hYGBgymDKBVIsrDk3LTOYEhnzWBmUmtOP8kGE2ZqTmNf8Xg6VCAJJZAEA< Vary: Accept-Encoding< Server: MochiWeb/1.1 WebMachine/1.6 (eat around the stinger)< Link: </riak/pivotal>; rel="up"< Last-Modified: Tue, 18 May 2010 21:32:02 GMT< ETag: 1VW7QmCuyofVCuQbqBNVYh< Date: Tue, 18 May 2010 21:32:06 GMT< Content-Type: text/html; charset=utf8< Content-Length: 19< * Connection #0 to host localhost left intact* Closing connection #0<h1>Hi Pivotal</h1>

Tuesday, December 7, 2010

basho

• Protocol Buffers Client

•Messages encoded using Protocol Buffers

• 3-10x speedups depending on data

•Native Erlang client

OTHER INTERFACES TOO!

Tuesday, December 7, 2010

Riak is a scalable, highly-available, networked

key/value store.

Tuesday, December 7, 2010

basho

Riak was designed to scale horizontally.

Tuesday, December 7, 2010

Tuesday, December 7, 2010

Tuesday, December 7, 2010

Tuesday, December 7, 2010

Tuesday, December 7, 2010

Tuesday, December 7, 2010

Riak is a scalable, highly-available, networked

key/value store.

Tuesday, December 7, 2010

Tuesday, December 7, 2010

Tuesday, December 7, 2010

Tuesday, December 7, 2010

#Replicas - N#Get response - R#Put responses - W

R+W > N for quorum

Tuesday, December 7, 2010

Tuesday, December 7, 2010

Tuesday, December 7, 2010

Tuesday, December 7, 2010

Tuesday, December 7, 2010

Tuesday, December 7, 2010

basho

WILL THE REAL OBJECT PLEASE STEP FORWARD?

• Riak always accepts writes - even during network partitions and other badness

•Objects are versioned to automatically detect ancestors/siblings

• Conflicts are detected on reads

• Eventually consistent

Tuesday, December 7, 2010

That sounds great... but can I do anything without a key?

Tuesday, December 7, 2010

basho

Query datasets withMap / Reduce

Tuesday, December 7, 2010

bashoTuesday, December 7, 2010

basho

function(v) { var m = v.values[0].data. match('\\w*','g'); var r = []; for(var i in m) if (m[i] != '') { var o = {}; o[m[i]] = 1; r.push(o); } return r;}

Tuesday, December 7, 2010

basho

map()map()map()map()map()map()map()map()function(v) { var m = v.values[0].data. match('\\w*','g'); var r = []; for(var i in m) if (m[i] != '') { var o = {}; o[m[i]] = 1; r.push(o); } return r;}

Tuesday, December 7, 2010

basho

map()

map()

map()

map()

map()

map()

map()

map()

Tuesday, December 7, 2010

basho

R8

R1

R2

R3

R4

R5

R6

R7

Tuesday, December 7, 2010

basho

R8R1R2R3R4R5R6R7reduce()

function(v) { var r = {}; for (var i in v) { for(var w in v[i]) { if (w in r) r[w] += v[i][w]; else r[w] = v[i][w]; } } return [r]; }

Tuesday, December 7, 2010

basho

Store relationshipswith links

Tuesday, December 7, 2010

basho

child

child

child

people/alicepeople/bob

people/dean

people/claire

Tuesday, December 7, 2010

basho

child

father

child

mother

childmother

people/alicepeople/bob

people/dean

people/claire

Tuesday, December 7, 2010

basho

child

father

daughter child

motherdaughter

childmother

son

grandchild

grandchild

people/alicepeople/bob

people/dean

people/claire

Tuesday, December 7, 2010

basho

people/alice

child

father

daughter child

motherdaughter

childmother

son

people/bob

GET /riak/person/bob/people,child,_key link

bucketlinktag

people/dean

people/claire

Tuesday, December 7, 2010

basho

people/claire

child

father

daughter child

motherdaughter

childmother

son

GET /riak/person/bob/people,child,_/_,child,_key link1

bucketlink1tag

link2bucket

link2tag

people/alicepeople/bob

people/dean

Tuesday, December 7, 2010

basho

people/claire

people/alicepeople/bob

people/dean

child

father

daughter child

motherdaughter

childmother

son

GET /riak/person/bob/people,child,1/people,child,_

Tuesday, December 7, 2010

COMPARED TO RDBMS

•No schema

•No transactions

•No joins (but we do have map/reduce)

•No secondary indices (but we do have links!)

•No schema migrations - version your objects

•No replication topologies - just add nodes to scale

Tuesday, December 7, 2010

basho

CLIENT LIBRARIES

JavascriptJava

.NET linq Twisted Python

Ruby

Tuesday, December 7, 2010

basho

RIAK IN PRODUCTION

Tuesday, December 7, 2010

basho

MOCHI MEDIA

•Multiple clusters in production

• Sessions (web and Flash) - 5 nodes, ~20MM keys - highest traffic

•User data storage - 3 nodes, bucket-per-game

•URL Shortener - 2 nodes, bucket-per-game

• Social graph - 3 nodes, OAuth credentials, relationships

Text and link here but not here

Title on white

Developer Center Advertiser CenterPublisher Center

www.mochimedia.com

Tuesday, December 7, 2010

basho

MOZILLA TEST PILOT

•Data collector for anonymized Firefox usage statistics

•High peak throughput - pure writes

• Large MapReduce queries for analytics

http://bit.ly/aC0i4f

“Riak meets or exceeds all the write performance requirements...it was nice to

see predictable performance and stability under load.”

Tuesday, December 7, 2010

basho

WEGEO

•Mobile Productivity / Collaboration App- Task lists, Shopping lists, Calendar

• Event and Check-in logs

•Monthly reports archive

• Third-party coupon and deal aggregation

“Scalability I could understand, on a platform I could understand.”

Tuesday, December 7, 2010

GETTING RIAKPrebuild Packages

http://downloads.basho.com

https://github.com/basho

The Bleeding Edge

http://bitbucket.org/basho

Tuesday, December 7, 2010

basho

http://wiki.basho.comfollow twitter.com/basho/team

riak-users@lists.basho.com#riak on Freenode

Tuesday, December 7, 2010

top related