hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to...

38
from hand to mouth

Transcript of hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to...

Page 1: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

fromhandtomouth

Page 2: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

Pavlo Baron

[email protected]@pavlobaron

Geek‘sGuide

To The Working Life

Page 3: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

Forget backend

Page 4: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

Or at least whatyou call a backend

Page 5: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

Your application serverwill just slow downyour machines tokeep step with them

Page 6: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

Or you will slow downyour incoming trafficto give your applicationserver a chance tobreathe

Page 7: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

It's like: order foodat McDonalds, getqueued and receivethe ordered foodthrough mail 3days later

Page 8: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

Trying to speed it upis like: order food atMcDonalds, get queued,leave the restaurantwith color pictures ofyour food and wait 3days for its delivery

Page 9: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

Every single dataabstraction layer onlyhelps ruin theatmosphere throughheating

Page 10: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

Hey, man,you carry around a damnUSS Enterprise in yourpocket

And you can run adamn Babylon 5 in

a cluster

Page 11: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

And in the end, it'salways store/update/delete/read/search/process.

Isn't it?

Page 12: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

So why drive a clown carwhen you can havea Ferrarifull of these?

Page 13: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

Why not just livefrom hand to mouth?

Page 14: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

You haz this?

Mobile clients write fromeverywhere, buffer,read occasionally,post-processing completelybehind the scenes, likestatistics etc.

Page 15: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

Zoom in!

Immediate, reliable, massivewrites. Analytics andprocessing in a batchafterwards. No need tobe exact to the secondand 100% data complete

Page 16: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

Zoom in!

Page 17: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

Zoom in!

Buffer

local

ProtoBufs, REST

Round Robin

Web Apps,R,

tools etc.

REST, local Erlang

Page 18: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

HTF does it work?

Page 19: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

Da core

Page 20: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

Da ring

X bit integer space0 <= N <= 2 ^ X

or: 2 x Pi0 <= A <= 2 x Pix(N) = cos(A)y(N) = sin(A)

Page 21: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

Da cluster

12 partitions (constant)3 nodes, 4 vnodes each

add node4 nodes, 3 vnodes each

Alternatives:3 nodes, 2 x 5 + 1 x 2 vnodes

container based

Page 22: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

Da quorum

V: vnodes holding a keyW: write quorumR: read quorumDW, PW, PR

W > 0.5 * VR + W > V

Page 23: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

Key = “foo”# = N, W = 2

N

Insert key(sloppy quorum)

replicate

ok

Page 24: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

leave

Add node

copy

copy

leave

leave

copy

Page 25: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

Key = “foo”# = N, R = 2

N

Lookup key(sloppy

quorum)

Value = “bar”

Page 26: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

leave

Removenode

copy

Page 27: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

stableupdates

Da Gossip

RM1Clock table

Replica clock

Update logValueclock

Value

Executed operation table

write RM2

Page 28: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

Node 1

Node 2

Node 3

1,0,0

1,2,0

3,2,0

1,3,31,1,0

1,0,1 1,2,2 1,2,3

2,2,0 4,3,3

4,4,3

4,3,4

Da vector clocks

Page 29: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

Da MapReduce

map reduce

Node X

Node C

N ="Alice"

map

query ="Alice"

Node A

N =„Alice"

Node B

N ="Alice"

map

hitlist

Page 30: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

Da hinted handoff

N: node, G: group including N

node(N) is unavailablereplicate to G orstore data(N) locallyhint handoff for later

node(N) is alivehandoff data to node(N)

Page 31: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

Key = “foo”

N

replicate

Key = “foo”, # = N ->handoff hint = true

Replicafails

Page 32: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

Replicarecovershandoff

Page 33: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

And that's by far not all:

You can search throughindex with data locality.

You can tag objects andquery through 2i.

You can add hooks

Page 34: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

You don't even need to storeanything.

Just distribute yourcalculation, search, batch

Page 35: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

Have a look at tendita.com

Page 36: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

So it's even comfy to loadyour clown carwith these

Page 37: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

Thank you

Page 38: hand to mouth - nosqlroadshow.comnosqlroadshow.com/.../slides/Baron_HandToMouth.pdf · hand to mouth. Pavlo Baron pavlo.baron@codecentric.de @pavlobaron Geek‘s Guide To The Working

Most images originate fromistockphoto.com

except few ones takenfrom Wikipedia or Flickr (CC)

and product pages/publicly available presentations

or generated through publiconline generators