(gam201) scalable game architectures that don't break the bank | aws re:invent 2014

51

Upload: amazon-web-services

Post on 24-Jun-2015

700 views

Category:

Technology


2 download

DESCRIPTION

In this session, AWS shares best practices for mobile, console, and MMO games that can scale from 1,000 to 1,000,000 users. See how to create a game backend using Amazon EC2 and AWS Elastic Beanstalk. Learn about database scaling challenges, and how to use Amazon DynamoDB and Amazon ElastiCache to address them. And, hear how to deliver game assets efficiently using Amazon S3 and Amazon CloudFront. Then, hear from Roope Kangas, Lead Server Developer and co-founder at Grand Cru, about their journey launching and cost-optimizing Supernauts on AWS. Grand Cru used load testing to validate their system before launch, enabling them to reach 1 million users in 6 days. Then, after launch, the team optimized their architecture based on system metrics to cut their AWS costs by more than half.

TRANSCRIPT

Page 1: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014
Page 2: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014
Page 3: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014

Traditional: Rigid AWS: Elastic

Servers

Demand

Capacity

Excess Capacity

Wasted $$

Demand

Unmet Demand

Upset Players

Missed Revenue :(

Page 4: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014

11 Regions

52 Edge Locations

Continuous Expansion

Page 5: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014

Multiplayer

Leaderboards

Multi-platform Achievements

Power-ups

In-game purchases

Multi-ballBreak-out mode

Page 6: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014
Page 7: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014

ELB

• Choose region

• >=2 Availability Zones

• Amazon EC2 for app

• Elastic Load Balancing

• Amazon RDS database

• Multi-AZ

Region

Page 8: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014

ELB

• Amazon S3 for game data

• Assets

• UGC

• Analytics

Region

Page 9: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014

ELB

• Amazon S3 for game data

• Assets

• UGC

• Analytics

• ... with CloudFront!

Region

CloudFront

CDN

Page 10: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014

• Amazon S3 for game data

• Assets

• UGC

• Analytics

• ... with CloudFront!

• Auto Scaling Group

• Capacity on demand

• Respond to users

• Automatic healing

ELB

Region

CloudFront

CDN

Page 11: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014

• Amazon S3 for game data

• Assets

• UGC

• Analytics

• ... with CloudFront!

• Auto Scaling Group

• Capacity on demand

• Respond to users

• Automatic healing

• Amazon ElastiCache

• Memcached

• Redis

ELB

Region

CloudFront

CDN

Page 12: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014

• Games are write heavy

• Caching of limited use

• Key value key value

• Binary structures

• Database = bottleneck

ELB

Region

CloudFront

CDN

Page 13: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014

(not fun)

Page 14: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014

• Fully-managed

• NoSQL data store

• Provisioned throughput

• Secondary indexes

• PUT/GET keys

• Document Support!

• 400 KB Items

• Reindexing (Soon!)

• Auto Scaling (OSS)

ELB

Region

CloudFront

CDN

Page 15: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014

• Hash key = Primary key

• Range key = Sub key

• Range key = Sort key

• Others attributes are

undefined

• So… How to sort based

on Top Score?

UserID

(hash key)

BoardName

(range key)

TopScore TopScoreDate

"101" "Galaxy Invaders" 5842 "2014-09-15T17:24:31"

"101" "Meteor Blasters" 1000 "2014-10-22T23:18:01"

"101" "Starship X" 24 "2014-08-31T13:14:21"

"102" "Alien Adventure" 192 "2014-07-12T11:07:56"

"102" "Galaxy Invaders" 0 "2014-09-18T07:33:42"

"103" "Attack Ships" 3 "2014-10-19T01:13:24"

"103" "Galaxy Invaders" 2317 "2014-09-11T06:53:00"

"103" "Meteor Blasters" 723 "2014-10-19T01:14:24"

"103" "Starship X" 42 "2014-07-11T06:53:03"

Page 16: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014

• Create a secondary index!

• Set hash key to BoardName

• Set range key to TopScore

• Project extra attributes as needed

• Can now query by BoardName,

Sorted by TopScore

• Handles many common gaming

use case

BoardName

(hash key)

TopScore

(range key)

UserID

"Alien Adventure" 192 "101"

"Attack Ships" 3 "103"

"Galaxy Invaders" 0 "102"

"Galaxy Invaders" 2317 "103"

"Galaxy Invaders" 5842 "101"

"Meteor Blasters" 723 "103"

"Meteor Blasters" 1000 "101"

"Starship X" 24 "101"

"Starship X" 42 "103"

UserID

(hash key)

BoardName

(range key)

TopScore TopScoreDate

"101" "Galaxy Invaders" 5842 "2014-09-15T17:24:31"

Page 17: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014

• Document types: List, Map

• Document content addressing

"name": "Martin",

"games": ["Megablast","Spacerace"],

"score": {"Megablast" : 123,"Spacerace" : 41

}

"name": {"S": "Martin"

}"games": {

"L": [ { "S": "Megablast" },{ "S": "Spacerace" } ]

},"score": {

"M": {"Megablast": { "N": "123" },"Spacerace": { "N": "41" }

}}

, Boolean, Null

"name": {"S": "Martin"

}"games": {

"L": [ { "S": "Megablast" },{ "S": "Spacerace" } ]

},"score": {

"M": {"Megablast": { "N": "123" },"Spacerace": { "N": "41" }

}}

document.score.Megablast

Page 18: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014

SOV204 Scaling Up to Your First 10 Million Users

SDD407 Amazon DynamoDB: Data Modeling and Scaling Best Practices

GAM302 EA's Real-World Hurdles with Millions of Players in the

Simpsons: Tapped Out

Page 19: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014

Region

• API backend app

• Core session

• Matchmaking

• S3+CloudFront

• DLC, assets

• Game saves

• UGC

• Public server tier

• Direct client socket

• Scale on players

Page 20: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014

① Login via API

② Request matchmaking

③ Get game server IP

Region

Page 21: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014

① Login via API

② Request matchmaking

③ Get game server IP

④ Connect to server

⑤ Pull down assets

⑥ Other players join

Region

Page 22: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014

Region ARegion B

Page 23: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014

GAM402 Deploying a Low-Latency Multiplayer Game Globally: Loadout

GAM404 Gaming DevOps: Scopely's Continuous Deployment Pipeline

GAM405 Create Streaming Game Experiences with Amazon AppStream

Page 24: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014
Page 25: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014
Page 26: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014
Page 27: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014
Page 28: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014
Page 29: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014
Page 30: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014
Page 31: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014
Page 32: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014
Page 33: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014
Page 34: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014
Page 35: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014
Page 36: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014
Page 37: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014
Page 38: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014
Page 39: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014

Load test environment

Metrics tools

Page 40: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014

0 20 40 60 80

05

00

01

000

01

50

00

20

000

25

00

03

00

00

Engine Ping

Minutes

Mill

ise

co

nds

ccu

95th

max

median

min

0 20 40 60 80

05

00

01

000

01

50

00

20

000

25

00

03

00

00

Join OK

Minutes

Mill

ise

co

nds

ccu

95th

max

median

min

0 20 40 60 80

05

00

01

00

00

150

00

20

00

02

500

030

00

0

Spawn OK

Minutes

Mill

ise

co

nd

s

ccu

95th

max

median

min

0 20 40 60 80

05

00

01

00

00

150

00

20

00

02

500

030

00

0

Turf API

Minutes

Mill

ise

co

nd

s

ccu

95th

max

median

min

bad

Page 41: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014

0 20 40 60 80 100

020

00

04

00

00

60

00

08

00

00

Engine Ping

MinutesM

illis

eco

nds

ccu

95th

max

median

min

0 20 40 60 80 100

020

00

04

00

00

60

00

08

00

00

Join OK

Minutes

Mill

ise

co

nds

ccu

95th

max

median

min

0 20 40 60 80 100

02

00

00

40

00

06

00

00

80

00

0

Spawn OK

Minutes

Mill

ise

co

nd

s

ccu

95th

max

median

min

0 20 40 60 80 100

02

00

00

40

00

06

00

00

80

00

0

Turf API

Minutes

Mill

ise

co

nd

s

ccu

95th

max

median

min

Better!

Page 42: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014
Page 43: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014
Page 44: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014
Page 45: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014
Page 46: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014
Page 47: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014
Page 48: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014
Page 49: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014

GAM303 Beyond Game Servers: Load Testing, Rendering, and Cloud Gaming

WEB306 UI, Load, and Performance Testing Your Websites on AWS

GAM301 Real-Time Game Analytics with Kinesis, Redshift, and DynamoDB

GAM304 How Riot Games re:Invented their AWS Model

ARC302 Running Lean Architectures: How to Optimize for Cost Efficiency

Page 50: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014

wow

so managed

much gaming

such available

very scaling

Page 51: (GAM201) Scalable Game Architectures That Don't Break the Bank | AWS re:Invent 2014

Please give us your feedback on this session.

Complete session evaluations and earn re:Invent swag.

http://bit.ly/awsevals