21
CHOOSING THE RIGHT DATABASE for SOCIAL and MOBILE GAMES Nguyen Thanh Quan Lead System Engineer SO6 - G6 Division

OGDC2013_Choosing the right database for social & mobile game_Mr Nguyen Thanh Quan

  • Upload
    ogdc

  • View
    1.590

  • Download
    0

Embed Size (px)

DESCRIPTION

Presentation in OGDC 2013 organized by VNG Corp

Citation preview

Page 1: OGDC2013_Choosing the right database for social & mobile game_Mr Nguyen Thanh Quan

CHOOSING THE RIGHT

DATABASE for SOCIAL and

MOBILE GAMES

Nguyen Thanh Quan

Lead System Engineer

SO6 - G6 Division

Page 2: OGDC2013_Choosing the right database for social & mobile game_Mr Nguyen Thanh Quan

Talk Overview

Part II. Decision principlesPart III. Choosing the right database

Part I. Our story

Page 3: OGDC2013_Choosing the right database for social & mobile game_Mr Nguyen Thanh Quan

• G6’s typical social game

• Game architecture

• Problems

• Evolution

4POINTS

Part I. Our story

Page 4: OGDC2013_Choosing the right database for social & mobile game_Mr Nguyen Thanh Quan

G6’s typical social game

Page 5: OGDC2013_Choosing the right database for social & mobile game_Mr Nguyen Thanh Quan

Game architecture

• High production

quality game

• Game logic in

client

• Can keep a socket

Flash

Client Side

Server Side

• Base on a LAMP

stack

• Game logic in PHP

• HTTP connection

Web stack

Page 6: OGDC2013_Choosing the right database for social & mobile game_Mr Nguyen Thanh Quan

Client

Web server #1

Web server #n

Web server #2

Game architecture

Page 7: OGDC2013_Choosing the right database for social & mobile game_Mr Nguyen Thanh Quan

Game architecture

-

50,000

100,000

150,000

200,000 DAUs

DAUs

Page 8: OGDC2013_Choosing the right database for social & mobile game_Mr Nguyen Thanh Quan

Problems

• Memory, hardware

has limitation

• Not easy for scaling

out

• 4,000 operation per

second

• 1,000 write per

second

• Parsing, locking,

logging, threads …

Page 9: OGDC2013_Choosing the right database for social & mobile game_Mr Nguyen Thanh Quan

Evolution

Data is growing rapidly

Hardware is not merging as that of data growth

Hard to scale using traditional way

Page 10: OGDC2013_Choosing the right database for social & mobile game_Mr Nguyen Thanh Quan

Part II. Decision principles

High performan

ce

High availabili

ty

High scalabilit

yLow in cost

Outage stories: zynga, wooga

Page 11: OGDC2013_Choosing the right database for social & mobile game_Mr Nguyen Thanh Quan

Part III. Choosing the right database

Page 12: OGDC2013_Choosing the right database for social & mobile game_Mr Nguyen Thanh Quan

Pick the right tool for the job

Page 13: OGDC2013_Choosing the right database for social & mobile game_Mr Nguyen Thanh Quan

Why NoSQL?

HighPerformance

High Scalabilit

y

Always On

Flexible Data

Model

Page 14: OGDC2013_Choosing the right database for social & mobile game_Mr Nguyen Thanh Quan

NoSQL – Disadvantage

• Can’t be use for analytics, reporting …

• Lack of relation from one key to another

• Packing and un-packing of each key

• Need whole value from the key; to

read/write any partial information

Page 15: OGDC2013_Choosing the right database for social & mobile game_Mr Nguyen Thanh Quan

Comparison

• Fast enough

• Disk based

• 4,000 OPS

• 1,000 write/s

MySQL

• Super fast

• RAM based

• 50,000 OPS

• Writes are fast as

reads

NoSQL

Page 16: OGDC2013_Choosing the right database for social & mobile game_Mr Nguyen Thanh Quan

Game architecture

Client

Web #1

Web #n

Web #2

NoSQL

DB

Real-time dataAnalytics data

Page 17: OGDC2013_Choosing the right database for social & mobile game_Mr Nguyen Thanh Quan

Our result

We reached 1 million DAUs

-

500,000

1,000,000

1,500,000

2,000,000

DAUs

DAUs

Page 18: OGDC2013_Choosing the right database for social & mobile game_Mr Nguyen Thanh Quan

Next stories

… and our journey continues…

Page 19: OGDC2013_Choosing the right database for social & mobile game_Mr Nguyen Thanh Quan

-

50,000

100,000

150,000

200,000

DAUs

DAUs

Summarize

Evolution everyday

Page 20: OGDC2013_Choosing the right database for social & mobile game_Mr Nguyen Thanh Quan

Revolution if necessary

Summarize

Page 21: OGDC2013_Choosing the right database for social & mobile game_Mr Nguyen Thanh Quan

OPEN GAME DEVELOPMENT

CONFERENCE

2013

Nguyen Thanh Quan

Lead System Engineer

SO6 - G6 Division