NoSQL Games

95
NOSQL GAMES Patrick Huesler wooga GmbH

description

This talk explains how we use NoSQL databases at wooga to scale our backend services to deal with the data of millions of players every day. Learn from our experience running Basho's Riak in production and how to use Amazon S3 as a database.

Transcript of NoSQL Games

Page 1: NoSQL Games

NOSQL GAMESPatrick Hueslerwooga GmbH

Page 2: NoSQL Games

play?D! "!# $%&' (!

Page 3: NoSQL Games
Page 4: NoSQL Games
Page 5: NoSQL Games
Page 6: NoSQL Games
Page 7: NoSQL Games
Page 8: NoSQL Games

challengestechnical

Page 9: NoSQL Games

for Diamond Dash20,543,500monthly active users

http://www.appdata.com/apps/facebook/127995567256931-diamond-dash (03/10/2012)

Page 10: NoSQL Games

for Diamond Dash3,871,133daily active users

http://www.appdata.com/apps/facebook/127995567256931-diamond-dash (03/10/2012)

Page 11: NoSQL Games

for Monster World6,500 RPS

backend traffic up to

Page 12: NoSQL Games

Database?what does mean that for a

Page 13: NoSQL Games

write heavyread/write ratio?

Page 14: NoSQL Games

of architectureEVOLUTION

Wooga’s

Page 15: NoSQL Games

Game backend

iOS

Flash

Facebook

Reporting

Page 16: NoSQL Games
Page 17: NoSQL Games

... well, nginx instead of apache

LAMPBuilt with

Page 18: NoSQL Games

scalemysql does

Page 19: NoSQL Games

use casesfor certain

Page 20: NoSQL Games

peoplewith the right

Page 21: NoSQL Games
Page 22: NoSQL Games

cloudTo the

Page 23: NoSQL Games

instead of PHPRailsLet’s use

Page 24: NoSQL Games

load balancer

app server app server app server

master shard 1 master shard 2

slave shard 2 slave shard 2

Page 25: NoSQL Games

shortstory

long

Page 26: NoSQL Games
Page 27: NoSQL Games

load balancer

app app app app app app app app

db db db db db db db db

db db db db db db db db

app app app app app app app app

app app app app app app app app

Page 28: NoSQL Games

use casedifferent

Page 29: NoSQL Games

Are NOTarcade games

farming games

Page 30: NoSQL Games

going to workNOT

5is is

Page 31: NoSQL Games

at the end of the tunnelLight

but there is

Page 32: NoSQL Games
Page 33: NoSQL Games

to redisSLOW PARTS

Move

Page 34: NoSQL Games

rinsE and REPEAT

Page 35: NoSQL Games
Page 36: NoSQL Games
Page 37: NoSQL Games

dedicatedback to

Page 38: NoSQL Games

for the buckbangMore

Page 39: NoSQL Games

MachinesFaster

Page 40: NoSQL Games

networkfaster

Page 41: NoSQL Games

all the wayREdisLet’s use

Page 42: NoSQL Games

load balancer

app server app server app server

redis

redis slave

Page 43: NoSQL Games

REDIS HASH

Page 44: NoSQL Games

Redis Landall is well in

Page 45: NoSQL Games
Page 46: NoSQL Games
Page 47: NoSQL Games

Memory Leaks

Page 48: NoSQL Games

work again?BGSAVEhow does

Page 49: NoSQL Games

workingno longerdumps are

Page 50: NoSQL Games
Page 51: NoSQL Games

going to workNOT

5is is

Page 52: NoSQL Games
Page 53: NoSQL Games

Restore on Demand

6x it with

Page 54: NoSQL Games

(never really supported)Disk Store

Redis

Page 55: NoSQL Games
Page 56: NoSQL Games

StatefulLet’s go

Page 57: NoSQL Games

is faster than no databasedatabase

no

Page 58: NoSQL Games

all the wayS3

Let’s use

Page 59: NoSQL Games

erlangLet’s use

Page 62: NoSQL Games
Page 63: NoSQL Games

SPARTANproject

Page 64: NoSQL Games
Page 65: NoSQL Games
Page 66: NoSQL Games

yesterdayready

it has to be

Page 67: NoSQL Games

enormouslyscale

It has to

Page 68: NoSQL Games
Page 69: NoSQL Games

node.js

Page 70: NoSQL Games

without sharding?Scales

What DB

Page 71: NoSQL Games

masterless replication?

what DB has

Page 72: NoSQL Games

Async Saving

Page 73: NoSQL Games

Riak

Page 74: NoSQL Games

for nowgood enough

Page 75: NoSQL Games

for goodgood enough

Page 76: NoSQL Games
Page 77: NoSQL Games

Riaklife with

Page 78: NoSQL Games

1 { 2 "userId" : 1000000011100, 3 "xp" : 20, 4 "coins" : 400, 5 "cash" : 300, 6 "rooms" : [ 7 { 8 "id" : 1, 9 "type" : "x-ray", 10 "status" : "busy" 11 } 12 ] 13 } 14

Page 79: NoSQL Games
Page 80: NoSQL Games

is plain awesomeSPoF

no

Page 81: NoSQL Games

for our use casesuboptimal

bitcask was

Page 82: NoSQL Games

over all keys!map/reduce

Do not

Page 83: NoSQL Games

ulimitdread8l

Page 84: NoSQL Games

riak Attachthe tale of

Page 85: NoSQL Games
Page 86: NoSQL Games

MobileMonsters go

Page 87: NoSQL Games
Page 88: NoSQL Games

a flash clientNOT

An iOS client is

Page 89: NoSQL Games

at all?databasedo we need a

Page 90: NoSQL Games

in a stateless architecture?s3

Could we just use

Page 91: NoSQL Games

at all?backenddo we need a

Page 92: NoSQL Games

writes toclientwhat if the

S3?

Page 93: NoSQL Games

wooga.com/jobs