NOSQL GAMES Patrick Huesler wooga GmbH
D o you like to play?
technical challenges
monthly acti v e use r s 20,543,500 f o r D iamond D ash http:/ /www.appdata.com/apps/facebook/127995567256931-diamond-dash (03/10/2012)
daily acti v e use r s 3,871,133 f o r D iamond D ash http:/ /www.appdata.com/apps/facebook/127995567256931-diamond-dash (03/10/2012)
b ackend t r affic up to 6,500 RPS f o r M onste r W o r ld
w hat does mean that f o r a Database?
r ead /wr ite r atio ? write heavy
W ooga ’ s EVOLUTION o f a r chitectu r e
Facebook Game backend Flash Reporting iOS
B uilt w ith LAMP ... w ell , nginx instead o f apache
mys q l does scale
f o r ce r tain use cases
w ith the r ight people
T o the cloud
L et ’ s use Rails instead o f PHP
load balancer app server app server app server master shard 1 master shard 2 slave shard 2 slave shard 2
long story sho r t
load balancer app app app app app app app app app app app app app app app app app app app app app app app app db db db db db db db db db db db db db db db db
diffe r ent use case
a r cade games Are NOT f a r ming games
Tis is NOT going to w o r k
b ut the r e is Light at the end o f the tunnel
M o v e SLOW PARTS to r edis
rinsE and REPEAT
b ack to dedicated
M o r e bang f o r the b uck
F aste r Machines
f aste r network
L et ’ s use REdis all the w ay
load balancer app server app server app server redis redis slave
REDIS HASH
all is w ell in Redis Land
Memory Leaks
ho w does BGSAVE w o r k again ?
dumps a r e no longer w o r king
Tis is NOT going to w o r k
Fx it w ith Restore on Demand
R edis Disk Store ( ne v e r r eally suppo r ted )
L et ’ s go Stateful
no database is f aste r than no data b ase
L et ’ s use S3 all the w ay
L et ’ s use erlang
http://www.slideshare.net/wooga/from-0-to-1000000-daily-users-with-erlang
http://www.slideshare.net/wooga/from-0-to-1000000-daily-users-with-erlang
p r oject SPARTAN
it has to b e ready yeste r day
I t has to scale eno r mously
node.js
W hat DB Scales w ithout sha r ding ?
w hat DB has masterless replication?
Async Saving
Riak
good enough for now
good enough for good
li f e w ith Riak
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
no SPoF is plain a w esome
b itcask w as suboptimal f o r ou r use case
D o not map/reduce o v e r all keys !
d r eadfl ulimit
the tale o f riak Attach
M onste r s go Mobile
A n i OS client is NOT a flash client
do w e need a database at all ?
C ould w e just use s3 in a stateless a r chitectu r e ?
do w e need a backend at all ?
w hat i f the client wr ites to S3?
wooga.com/ jobs
Recommend
More recommend