![Page 1: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/1.jpg)
© 2014 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified, or distributed in whole or in part without the express consent of Amazon.com, Inc.
November 12, 2014 | Las Vegas
GAM301
Real-Time Game Analytics with Amazon Kinesis,
Amazon Redshift, and Amazon DynamoDB
Suhas Kulkarni – VP Engineering, GREE International
Kandarp Shah – Engineering Manager, GREE International
![Page 2: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/2.jpg)
Talk Outline
• Mobile Game Analytics – use case
• Decisions, Mistakes & Challenges
• Deep dive – Analytics Platform using AWS Tech
• Lessons we learned
![Page 3: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/3.jpg)
GREE Headquarters
Tokyo, Japan
GREE International,
Inc.
San Francisco, CA
GREE Canada
Vancouver, BC
QUICK FACTS
6Continents playing GREE games
1,882Employees Worldwide
13Games made in North America
2004
2011
2013
MILESTONES GAME STATS - 4 titles in top 100 grossing*
Crime City (Studios)
Reached Top 10 Grossing in 140 countries
Top 100 Grossing in 19 countries, over 3 years
since launch
*As of Sep. 2014 – Source: App Annie
A Global Gaming Powerhouse
Knights & Dragons (Publishing)
Reached Top 10 Grossing in 41 countries
Top 100 Grossing in 22 countries
![Page 4: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/4.jpg)
Success Factors in Mobile Gaming
• Great gameplay & mechanics
• Great content
• Effective engagement & retention
• Generate in-app purchases
….. keep adding new content, features
??
?
I know its a
great game.
Why is my
game not
successful
anymore?
It had good
KPIs initially.
![Page 5: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/5.jpg)
As a game developer ...
Why?
• Game not performing well
• Players not spending?
• Retention so poor?
How?
• Optimize game design
• Improve ARPDAU, %Spenders
• Improve Retention
You need – Game Analytics & Insights
![Page 6: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/6.jpg)
Analytics @ GREE
Ad Clicks
Downloads
Perf Data
Attribution
Campaign Performance
SC Balance
HC Balance
IAP
Player Targeting
![Page 7: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/7.jpg)
Data Collection
• Mobile Devices
• Game Servers
• Ad Networks
• Size of event ~ 1 KB
• 500M+ events/day
• 500G+/day & growing
• JSON format
Source of Data Data Size & Growth
![Page 8: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/8.jpg)
Database Schema
• Every game – database schema
• Each game event = table (e.g., battle_fight, iap)
• 40-50 tables per DB schema
• All game titles ~ 1000 tables in DW
![Page 9: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/9.jpg)
Key Requirements
• Data collection & streaming to database
• Zero data loss
• Zero data corruption
• Guaranteed data delivery
![Page 10: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/10.jpg)
History – Analytics Architecture
![Page 11: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/11.jpg)
Gen 1 – Analytics Platform
Analytics DB
Game DB
LAMP
Built on a LAMP Stack
Sharded DBs
Not scalable
Game
Servers
![Page 12: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/12.jpg)
Gen2 – Flume/MPP Data
Warehouse
Game DB
MPP Data WarehouseFlume
Collectors
Flume
Master
Consumer
Game
Servers
![Page 13: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/13.jpg)
In-house: Relay Engine
Game DB
Replicator
Amazon S3
DW
Relay Pipeline
Senders
Copiers
Game
Servers
Listeners
Cost of maintenance - HIGH
![Page 14: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/14.jpg)
Challenges
• Hard to maintain and scale
• Spike in Live Ops events can clog other events
• Difficult to add new sink
• Writes to DW impacted query performance for BI
users
• Poor data latency
![Page 15: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/15.jpg)
Key Requirements – the list grew
• Data collection &
streaming to database
• Zero data loss
• Zero data corruption
• Guaranteed data
delivery
• Near real-time data latency
• Real-time ad-hoc analysis
• Ease of adding consumers
• Managed Service
![Page 16: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/16.jpg)
New Analytics Architecture
![Page 17: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/17.jpg)
Start Simple
Ingest
• Kafka
• HTTP PUT
• Amazon Kinesis
Store
• HDFS
• Amazon S3
• Amazon Redshift
Analyze
![Page 18: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/18.jpg)
Producer & Data
Data
{"player_id":"323726381807586881","player_level":169,"device":"iPhone 5","version":"iOS 7.1.2”,"platfrom":"ios","client_build":"440”,"db":”mw_dw_ios","table":"player_login","uuid":"1414566719-rsl3hvhu7o","time_created":"2014-10-29 00:11:59”}
{"fight_time":"2014-10-29 00:11:59","attacker_id":"413142642356365377”, "attacker_clan_size":500,"attacker_level":270,"db":"mw_dw_ios","table":"battle_fight","uuid":"1414566719-p0oogk0bep","time_created":"2014-10-29 00:11:59"}
• PHP/Python Web Services
• Client side analytics SDK
Produce Send Consume Load
![Page 19: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/19.jpg)
Amazon Kinesis Sender
Produce Send Consume Load
![Page 20: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/20.jpg)
Sender
Sender
Worker
Kinesis
Stream
Shard 1
Shard 2
Shard 3
Shard n
Describe Stream
Sync Shards
Analytics
Files
Send
PutRecordCompress
Read Buffer
50KB
![Page 21: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/21.jpg)
Design Choices for Sender
• Single stream VS stream per game
• Batch VS Single Event
• Compressed VS Uncompressed
• PartitionKey VS ExplicitHashKey
![Page 22: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/22.jpg)
Sender Deployment
Elastic Load
Balancing
AMI
Amazon
EC2
Auto Scaling Group
Amazon
EBS Data
Volume
Pending: Wait
EC2 EBS Data
Volume
Amazon
S3
Sender
Scale
Out
Pending: Proceed
EC2 EBS Data
Volume
EC2
Auto Scaling Group
EBS Data
Volume
InService
Update
Terminating: Wait
EC2 EBS Data
Volume
Scale
InChecks
Terminating: Proceed
EC2 EBS Data
Volume
Terminated
![Page 23: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/23.jpg)
Consumer – S3 Store
Produce Send Consume Load
![Page 24: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/24.jpg)
Consumer – Amazon S3 Store
Kinesis
Stream
Shard 1
Shard 2
Shard n
S3File Metadata DB
Decompress De-Dupe
BufferTransformation
Validation Target Table
Compress
Size/
Timeout
Record
Consumer
Kinesis Client Library
Record Processor
Record Processor
Consumer
Kinesis Client Library
Record Processor
Auto Scaling Group
![Page 25: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/25.jpg)
Loading data into Amazon
Redshift
Produce Send Consume Load
![Page 26: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/26.jpg)
Loading data into Amazon Redshift
Amazon S3
File Metadata DB Amazon
Redshift
Update Status
Transaction
Create Manifest Execute COPY
Create Manifest Execute COPY
Create Manifest Execute COPY
Status
![Page 27: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/27.jpg)
Architecture – Simple Store
Produce Send Consume Load
![Page 28: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/28.jpg)
Architecture – Simple Store
S3
Amazon S3
Consumer
Game DB
Game
ServersKinesis
Amazon
Redshift
Amazon
Elastic
MapReduce
DSV
JSON
![Page 29: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/29.jpg)
Real-time Aggregates
![Page 30: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/30.jpg)
DynamoDB – Real-time Aggregates
Amazon
DynamoDB
DashboardConsumerKinesis
![Page 31: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/31.jpg)
Spark
![Page 32: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/32.jpg)
Spark – Real-time Analysis
Spark SQLSpark Streaming
SQLKinesis
![Page 33: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/33.jpg)
Final Architecture
![Page 34: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/34.jpg)
Amazon S3
Amazon
S3
Spark SQL
JDBC ServerSQL
Dashboard
Amazon
Redshift
Consumer
Amazon
EMR
Consumer
Game DB
Game
ServersKinesis
DynamoDB
DSV
JSON
![Page 35: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/35.jpg)
Lessons Learned
![Page 36: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/36.jpg)
Lessons Learned
Sender
• Decouple data generation from sending
• Batch and compress
• PutRecord HTTP:5XX can result in duplicates
• Monitor ProvisionedThroughputExceeded exception
![Page 37: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/37.jpg)
Lessons Learned (Cont.)
Consumer
• Use KCL
• Auto-scale and monitor load
Overall
• Provision enough shards
• Handle shutdown gracefully
• Follow AWS best practices for error retries and
exponential back-off
![Page 38: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/38.jpg)
Takeaway
![Page 39: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/39.jpg)
Takeaway
Kinesis
• Data available for processing within seconds
• Robust API, KCL, and Connector libraries
AWS
• Managed
• Scalable
• Cost effective
• Quick to get up and running
![Page 40: (GAM301) Real-Time Game Analytics with Amazon Kinesis, Amazon Redshift, and Amazon DynamoDB | AWS re:Invent 2014](https://reader034.vdocument.in/reader034/viewer/2022052316/5589e5fed8b42aaa0c8b45d5/html5/thumbnails/40.jpg)
Please give us your feedback on this session.
Complete session evaluations and earn re:Invent swag.
http://bit.ly/awsevals