ogdc2013_choosing the right database for social & mobile game_mr nguyen thanh quan
DESCRIPTION
Presentation in OGDC 2013 organized by VNG CorpTRANSCRIPT
![Page 1: OGDC2013_Choosing the right database for social & mobile game_Mr Nguyen Thanh Quan](https://reader036.vdocuments.site/reader036/viewer/2022062703/55529ffeb4c9051f108b548f/html5/thumbnails/1.jpg)
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](https://reader036.vdocuments.site/reader036/viewer/2022062703/55529ffeb4c9051f108b548f/html5/thumbnails/2.jpg)
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](https://reader036.vdocuments.site/reader036/viewer/2022062703/55529ffeb4c9051f108b548f/html5/thumbnails/3.jpg)
• 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](https://reader036.vdocuments.site/reader036/viewer/2022062703/55529ffeb4c9051f108b548f/html5/thumbnails/4.jpg)
G6’s typical social game
![Page 5: OGDC2013_Choosing the right database for social & mobile game_Mr Nguyen Thanh Quan](https://reader036.vdocuments.site/reader036/viewer/2022062703/55529ffeb4c9051f108b548f/html5/thumbnails/5.jpg)
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](https://reader036.vdocuments.site/reader036/viewer/2022062703/55529ffeb4c9051f108b548f/html5/thumbnails/6.jpg)
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](https://reader036.vdocuments.site/reader036/viewer/2022062703/55529ffeb4c9051f108b548f/html5/thumbnails/7.jpg)
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](https://reader036.vdocuments.site/reader036/viewer/2022062703/55529ffeb4c9051f108b548f/html5/thumbnails/8.jpg)
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](https://reader036.vdocuments.site/reader036/viewer/2022062703/55529ffeb4c9051f108b548f/html5/thumbnails/9.jpg)
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](https://reader036.vdocuments.site/reader036/viewer/2022062703/55529ffeb4c9051f108b548f/html5/thumbnails/10.jpg)
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](https://reader036.vdocuments.site/reader036/viewer/2022062703/55529ffeb4c9051f108b548f/html5/thumbnails/11.jpg)
Part III. Choosing the right database
![Page 12: OGDC2013_Choosing the right database for social & mobile game_Mr Nguyen Thanh Quan](https://reader036.vdocuments.site/reader036/viewer/2022062703/55529ffeb4c9051f108b548f/html5/thumbnails/12.jpg)
Pick the right tool for the job
![Page 13: OGDC2013_Choosing the right database for social & mobile game_Mr Nguyen Thanh Quan](https://reader036.vdocuments.site/reader036/viewer/2022062703/55529ffeb4c9051f108b548f/html5/thumbnails/13.jpg)
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](https://reader036.vdocuments.site/reader036/viewer/2022062703/55529ffeb4c9051f108b548f/html5/thumbnails/14.jpg)
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](https://reader036.vdocuments.site/reader036/viewer/2022062703/55529ffeb4c9051f108b548f/html5/thumbnails/15.jpg)
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](https://reader036.vdocuments.site/reader036/viewer/2022062703/55529ffeb4c9051f108b548f/html5/thumbnails/16.jpg)
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](https://reader036.vdocuments.site/reader036/viewer/2022062703/55529ffeb4c9051f108b548f/html5/thumbnails/17.jpg)
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](https://reader036.vdocuments.site/reader036/viewer/2022062703/55529ffeb4c9051f108b548f/html5/thumbnails/18.jpg)
Next stories
… and our journey continues…
![Page 19: OGDC2013_Choosing the right database for social & mobile game_Mr Nguyen Thanh Quan](https://reader036.vdocuments.site/reader036/viewer/2022062703/55529ffeb4c9051f108b548f/html5/thumbnails/19.jpg)
-
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](https://reader036.vdocuments.site/reader036/viewer/2022062703/55529ffeb4c9051f108b548f/html5/thumbnails/20.jpg)
Revolution if necessary
Summarize
![Page 21: OGDC2013_Choosing the right database for social & mobile game_Mr Nguyen Thanh Quan](https://reader036.vdocuments.site/reader036/viewer/2022062703/55529ffeb4c9051f108b548f/html5/thumbnails/21.jpg)
OPEN GAME DEVELOPMENT
CONFERENCE
2013
Nguyen Thanh Quan
Lead System Engineer
SO6 - G6 Division