Mais conteúdo relacionado Semelhante a AWS로 게임 기반 다지기 - 김병수, 박진성 :: AWS Game Master 온라인 세미나 #3 (20) Mais de Amazon Web Services Korea (20) AWS로 게임 기반 다지기 - 김병수, 박진성 :: AWS Game Master 온라인 세미나 #3 1. © 2021, Amazon Web Services, Inc. or its Affiliates.
AWS Korea Game Tech
June 22, 2021
Series #3. AWS로 게임 기반 다지기
2. © 2021, Amazon Web Services, Inc. or its Affiliates.
1부: 웹기반 게임이란 이런것이다!
API Gateway, ALB
AWS Solutions Architect 김병수
3. © 2021, Amazon Web Services, Inc. or its Affiliates.
웹기반 게임이란?
Frontend Backend
• Browser based game
• Javascript
• Canvas,WebGL
• 3-tierWeb backend
• webserver
• Application server
• Database
• RESTful API
4. © 2021, Amazon Web Services, Inc. or its Affiliates.
웹기반 게임이란?
• 전통적인 3-tier Web application architecture와 동일
• Browser game 뿐 아니라, native game들도 backend로 http(s)기반 RESTful
API를 사용한다면 해당 부분의 architecture는 3-tier web application을 사용할
수 있음
• Web 기술의 발전에 따라, browser game도 WebGL, Canvas를 활용하여 rich
player experience 제공 가능
5. © 2021, Amazon Web Services, Inc. or its Affiliates.
웹기반 게임이 가지는 장/단점
• 장점
• 잘 알려진 3-tier Web framework들이 있어 backend 구성 및 운영이 상
대적으로 쉽다.
• Node.js 와 같은 framework을 사용하면 frontend와 backend를 같은
언어(javascript, typescript)로 구현할 수 있어 개발 편이성이 높아진다.
• Stateless 한 http(s) 기반이므로 scale out/in이 용이하고 대부분의 3-
tier web framework이 이를 지원한다.
• Container 및 Microservice architecture로의 전환이 용이하다.
6. © 2021, Amazon Web Services, Inc. or its Affiliates.
웹기반 게임이 가지는 장/단점
• 단점
• Stateless한 http(s) 특성상 stateful한 처리에 별도의 처리가 필요하다
cache나 database, sticky session등을 활용하여 극복
• 매 http(s) request는 단발성이므로, persistent connection 처리가 어렵
다. (Websocket을 활용하여 극복)
7. © 2021, Amazon Web Services, Inc. or its Affiliates.
3-tier Web Architecture
8. © 2021, Amazon Web Services, Inc. or its Affiliates.
3-tierWeb Architecture for games
9. © 2021, Amazon Web Services, Inc. or its Affiliates.
3-tierWeb Architecture for games 요약
• 3-tier Web Architecture
• Presentation Layer: 실제 browser에서 loading할 html 파일들을 서비스.
Frontend Webserver들이 담당 ( apache, tomcat, NGINX … )
• Application Layer: Application server들로 구성되어 business logic의
처리를 담당. Language별 유명 Web framework들은 이 Application
layer의 관리 및 application 개발, 배포를 손쉽게 하는 기능들을 제공 ( ex)
python: flask, Django, java : Java EE, Spring, javascript/typescript:
node.js … )
• Data access layer: Data들을 저장하고 읽을 수 있도록 서비스하는 layer.
가장 높은 수준의 보안이 요구됨. RDBMS, NoSQL, In-memory DB(redis,
Memcached) 등이 Data access layer를 구성
10. © 2021, Amazon Web Services, Inc. or its Affiliates.
Presentation Layer
11. © 2021, Amazon Web Services, Inc. or its Affiliates.
Presentation Layer
Amazon CloudFront Application Load Balancer Amazon Simple Storage Service
(Amazon S3)
Amazon API Gateway
12. © 2021, Amazon Web Services, Inc. or its Affiliates.
Presentation Layer
• Cloudfront(CDN)를 통한 Lastmile 최소화
• 정적 컨텐츠: 전세계 Edge location에 http(s) request들에 대한 응답을
caching (게임 클라이언트 다운로드에 유용)
• 동적 컨텐츠: caching을 짧게 가져가거나 아예 비활성화하더라도 edge
location과 region간 AWS backbone network를 통해 서비스하게 되므로
routing 최적화 효과. Websocket 지원
• 보안: ACM을 통한 TLS/SSL 인증서 구성 가능 – backend의 https 통신
관련 handshake overhead 경감, WAF를 통한 Web 방화벽 구성 가능
• S3를 통한 정적 컨텐츠 제공
• 내구성: 11 9s - 99.999999999% 내구성 제공
• 보안: OAI를 통하여 Cloudfront에서만 접근가능하도록 구성 가능
13. © 2021, Amazon Web Services, Inc. or its Affiliates.
Presentation Layer
• Load Balancer(ALB)
• Web server 기능 대치: 기존 3-tier web Architecture에서 Frontend
webserver가 하던 http(s) request들을 Backend API server들에 routing하는
역할을 ALB가 대신 수행할 수 있음.
• 경로별 L7 Routing: EC2 instance, Lambda, IP(Container도 IP를 통해 지원)
• 자체적인 Scaling 지원: Traffic에 따라 ALB 자체가 Scaling됨
• 고급기능: ACM을 통한 TLS/SSL 인증서 지원 – Backend server의 https 통신
관련 handshake overhead 경감, Sticky Session 지원, Websocket 지원
• 보안: ALB가 Session을 앞단에서 맺고 있으므로 ALB만 Public subnet에
위치하도록 구성하고 모든 API Server들을 Private subnet으로 배치 가능.
Cloudfront를 통한 접근만 가능하도록 구성 가능. WAF를 통한 Web 방화벽
구성 가능
14. © 2021, Amazon Web Services, Inc. or its Affiliates.
Presentation Layer
• API gateway
• 지원 Target: lambda, AWS service APIs, http(s) backends
• RESTful API의 정의 및 routing 제공: REST API/HTTP API/Websocket
API의 method 정의 및 backend에 요청을 routing
• SDK 빌드 및 배포: http(s) request를 통한 접근 뿐 아니라, 지원되는 언어별로
API들에 대한 SDK를 생성하여 이를 통하여 API접근하도록 구성 가능(REST
API만 지원)
• Access location에 따른 배포: Private / Public, Edge 최적화 / Regional API
(REST API)
• 보안: Lambda Authorizer(Cognito 인증), IAM role base 인증 지원, Resource
기반 액세스 제어, VPC endpoint를 통한 Private API 배포 가능
• Request validation, transformation: backend로 요청을 보내기 전에
validation및 요청의 transformation 지원
15. © 2021, Amazon Web Services, Inc. or its Affiliates.
Application Layer
16. © 2021, Amazon Web Services, Inc. or its Affiliates.
Application Layer
AWS Elastic Beanstalk AWS Lambda
Amazon Lightsail Amazon Elastic Compute
Cloud (Amazon EC2)
Amazon Elastic Container
Service (Amazon ECS)
Amazon Elastic Kubernetes
Service (Amazon EKS)
AWS Fargate
Amazon Elastic Container
Registry (Amazon ECR)
EC2 기반 Container 기반 Serverless
17. © 2021, Amazon Web Services, Inc. or its Affiliates.
Application Layer
• API Server
• EC2 기반 구성: EC2, Lightsail, Beanstalk 등의 서비스를 이용하여 구성
가능
• Container 기반 구성: ECS, EKS, Fargate 등의 서비스를 이용하여
Container 기반 구성 가능
• Serverless 구성: Lambda를 활용한 serverless 구성 가능
• AutoScaling: Autoscaling 구성을 통한 Traffic에 따른 Scaling 구성 가능,
Lambda의 경우 Autoscaling 구성 없이도 요청에 따라 자동 확장
• 보안: Security Group을 통하여 ALB를 통한 접근만 가능하도록 구성
가능, IAM role을 통하여 접근가능한 AWS Service 권한 제어
18. © 2021, Amazon Web Services, Inc. or its Affiliates.
State를 어떻게 관리할 것인가?
• HTTP(s) 기반 한계: Web framework은 모든
request들이 stateless하다고 가정하지만,
대부분의 game들은 state 관리가 필요
• 문제점:
1) Player들의 request들이 같은 Application
server로 routing된다는 보장이 없음
2) 각 Application들이 모든 player들의
state를 관리하기 위해서는 application
server들간의 state sharing이 필요하고,
Auto scaling시 overhead가 과도해짐
3) Application down시 player state가 유실될
수 있음.
19. © 2021, Amazon Web Services, Inc. or its Affiliates.
State를 어떻게 관리할 것인가?
• State 관리 방안
• Client에서 state 관리: browser나 game client에서 state를 관리. (ex)
browser의 session storage나 local storage를 활용하여 state를
관리하고 매 request마다 state를 포함하여 요청. Client 조작에 취약
• Server에서 관리:
1) Sticky Session 기능 사용: Application에서 state를 관리하고, ALB의
Sticky session을 활용하여 요청이 같은 Application server로 routing되도록
구성. Application 이 down되었을 때 처리가 어렵고, traffic이 일시적으로
편중될 수 있음
2) 별도의 Session storage 사용: 보통 session storage로 in-memory DB
( Memcached/redis)사용
20. © 2021, Amazon Web Services, Inc. or its Affiliates.
Data Access Layer
21. © 2021, Amazon Web Services, Inc. or its Affiliates.
Data Access Layer
Amazon Relational Database
Service (Amazon RDS)
Amazon ElastiCache Amazon DocumentDB
(with MongoDB compatibility)
Amazon DynamoDB
Amazon Aurora
RDBMS
Cache
(In-memory DB) NoSQL
22. © 2021, Amazon Web Services, Inc. or its Affiliates.
Data Access Layer
• 직접 구성
• Self-hosting : EC2 위에 직접 Database 구성, HA 구성, backup 구성, Read replica 구성 등을 직접
구성하고 운영하는 방식
• 보안: Security Group을 통한 access 제어, VPC peering을 통한 multi-region, multi-VPC 접근 제어,
Database engine 자체 access 제어 기능 사용
• RDS
• 관리형 RDBMS 서비스: MySQL, MariaDB, PostgreSQL, Oracle, Microsoft SQL server,
Aurora(MySQL/PostgreSQL) RBMS engine에 대한 관리형 서비스 제공
• 보안: Security Group을 통한 access 제어, Secrets manager를 통한 자동 credential rolling, IAM role을
통한 액세스 제어, VPC peering을 통한 multi-VPC, multi-region 접근 제어
• DynamoDB
• Serverless NoSQL 서비스: NoSQL Database를 serverless방식으로 제공하여 관리 point zero
• 보안: VPC Endpoint를 통한 private 접근 구성 가능, IAM role을 통한 접근권한 제어
• Elasticache
• 관리형 in-memory DB 서비스: redis, memcached engine에 대한 관리형 서비스 제공
• 보안: Security group을 통한 access 제어, VPC peering을 통한 multi-region, multi-VPC 접근제어, IAM
role을 통한 액세스 제어
23. © 2021, Amazon Web Services, Inc. or its Affiliates.
Data Access Layer
• DynamoDB best practice
• 성능을 위하여 Primary Key는 충분히 randomize가능하도록 구성 : Hot
partition 문제
• NoSQL은 Data scheme 이 필요하지 않으므로 각 row들이 서로 다른
scheme을 가질 수 있음. RDBMS와 달리 용도에 따라 Table을 구분하는
것이 아니라 한 Table에서 복수 목적의 data를 저장하고 query하는 것이
가능
25. © 2021, Amazon Web Services, Inc. or its Affiliates.
Demo Architecture
• Hybrid Architecture
• EC2, Container (Fargate),Lambda 동시
구성
• 기존 Application을 Self-hosting EC2,
container, serverless와 hybrid로
사용하거나 점진적으로 migration하는
용도로 사용가능
• API Gateway HTTP API 사용
• ALB로 대체 가능
• Systems manager
• Session manager 기능으로 bastion
host 대체
• DynamoDB
• 단일Table에 Composite Key (Identity
ID + type)으로 account 정보, play_log
를 처리
• Elasticache for Redis
• Read replica 구성
• SortedSet으로 Leaderboard 구성
26. © 2021, Amazon Web Services, Inc. or its Affiliates.
Demo
• 2048 with Google SSO, Leaderboard
• https://bit.ly/2S70LN1
• Just for demo and fun!
• 현재 state관리를 client(browser)의
session storage에 의존하도록 구현
• 쉬는시간 동안 Play하시고 Top 10
Leaderboard에 등재되도록 해보세요!
• PC에선 arrow key,
Smartphone에서는 swipe를
사용하시면 편합니다.
27. © 2021, Amazon Web Services, Inc. or its Affiliates.
Recipe & Estimate
28. © 2021, Amazon Web Services, Inc. or its Affiliates.
Recipe and Estimate
(https://calculator.aws/#/)
Scenario) Lambda / DynamoDB / Elasticache
• Lambda 비용 ($608.5)
• 하루 Lambda 요청이 100만개. Lambda 함수가 1초 구동 시 메모리 비용 $16.7 (하루) + 요청 갯수 1백만개 => $0.20 (하루)
• Lambda 함수 한달 기준 비용 => $507
• 한달에 API 요청은 3,000만개. API Gateway 에서 1백만 요청 무료. => 29 x $3.5(REST API) => $101.5
• DynamoDB 비용 ($146.36)
• DynamoDB RCU 월 8,000만건 및 WCU 월 2,000만건 On-demand => $146.36
• ElastiCache 비용 ($107.31)
• 3 instance(T3.small) x 0.04900000 USD hourly x 730 hours in a month => $107.31
• Total estimate : $862.17
29. © 2021, Amazon Web Services, Inc. or its Affiliates.
2부: 세션 기반 게임이란 이런 것이다!
Amazon GameLift, ETC
AWS Solutions Architect 박진성
30. © 2021, Amazon Web Services, Inc. or its Affiliates.
멀티플레이 게임을 위한 옵션들
세션 기반 멀티플레이
게임
비 실시간성/비동기
방식 게임
MMO 스타일의
Persistent 월드 기반
게임
31. © 2021, Amazon Web Services, Inc. or its Affiliates.
세션 기반 게임(Session Based Game) 이란?
• MO(Multiplayer Online) 형 게임이라고도 불립니다
• 실시간으로 다른 플레이어와 상호작용할 수 있는 게임 형태
• 일반적으로 TCP 또는 UDP 기반으로 동작합니다
• Stateful 하게 연결(Session) 을 유지합니다
• 대표적으로 FPS, 대전 격투, AOS, RTS 와 같은 장르들이 포함됩니다
• Persistent 월드 기반 게임(MMO) 와의 차이점?
• 게임이 보통 한 판(Single Match) 단위로 구성되며 단일 프로세스 처리가 용이합니다
32. © 2021, Amazon Web Services, Inc. or its Affiliates.
세션 기반 게임에 사용되는 네트워크 패턴
Player Player
Player Player
Dedicated
Server
Player
Player Player
Player
Peer To Peer (P2P) Dedicated Server
• 사용자의 게임 클라이언트가 호스트가 되는
방식
• 데이터 전송이 신속해지고 서비스 유지 비용
이 저렴하다
• 확장에 취약하며 클라이언트 연결 Risk 에 대
한 처리가 필요하다. NAT Punch 를 고려
• 신뢰할 수 있는 서버가 클라이언트 연결을 관
리하는 방식
• 확장성이 뛰어나며 운영 및 보안에 있어서 이
점을 갖는다. NAT Punch 를 고려하지 않아도
된다
• P2P 에 비해 느릴 수 있다
33. © 2021, Amazon Web Services, Inc. or its Affiliates.
세션 기반 게임 전반적인 아키텍처
Game Clients Ingame Servers
Outgame Servers
Databases
Database
Cache
34. © 2021, Amazon Web Services, Inc. or its Affiliates.
세션 기반 게임 Game Server 계층 – Access
Game Clients Ingame Servers
Outgame Servers
Databases
Database
Cache
35. © 2021, Amazon Web Services, Inc. or its Affiliates.
세션 기반 게임 Game Server 계층 – Access
Game Clients
Game Servers
Game Clients Matchmakers
Game Servers
세션 기반 게임 서버에 접근하기 위한 옵션들
Direct Access Matchmaking
36. © 2021, Amazon Web Services, Inc. or its Affiliates.
세션 기반 게임 Game Server 계층 – 매치메이킹
Serverless 기반의 매치메이킹 구현으로 실제 트래픽에 대해서 비용 최적화가 가능
사용자 경험과 게임의 재미를 극대화 시켜줄 수 있는 중요 포인트를 유연하게 구성
Amazon API
Gateway
Game clients
Client connects to dedicated game server
Dedicated
game server
AWS
Lambda
Amazon
DynamoDB
Session management
operations
AWS Cloud
Region A
Dedicated
game server
Dedicated
game server
Dedicated
game server
Dedicated
game server
Dedicated
game server
AWS
Lambda
Request
persistence
Session
requests
API Cache 및
Throttling 으로
백엔드 보호가 가능
사용량에 따른
확장 및 리소스
가용률 최적화
어떤 규모에서도 ms 단위의
안정적이고 빠른 성능을 제공
37. © 2021, Amazon Web Services, Inc. or its Affiliates.
세션 기반 게임 Game Server 계층 – Access
Amazon CloudFront AWS Global Accelerator
Edge 서비스 기반의 Tradeoff 없는 트래픽 가속화가 가능
글로벌 서비스 런칭에 있어서도 유연한 옵션을 제공
• Web 기반 트래픽 가속화 및 정적 컨
텐츠 캐싱을 제공하는 CDN 서비스
• Web Socket 을 활용한 세션 기반 게
임에 활용 가능
• 고정 IP 를 통한 TCP/UDP 기반의 트
래픽 성능을 최대 60% 향상
• Custom Routing 을 통한 여러 게임
서버 엔드포인트 매핑이 가능
38. © 2021, Amazon Web Services, Inc. or its Affiliates.
세션 기반 게임 Game Server 계층 – Access
Game Clients Matchmakers
Game Servers
HTTP based
Amazon
CloudFront
AWS Global
Accelerator
AWS Global
Accelerator
TCP based
UDP based
사용 사례에 알맞게 트래픽 가속화가 가능합니다
39. © 2021, Amazon Web Services, Inc. or its Affiliates.
세션 기반 게임 Game Server 계층 – 인게임 서버
Game Clients Ingame Servers
Outgame Servers
Databases
Database
Cache
40. © 2021, Amazon Web Services, Inc. or its Affiliates.
세션 기반 게임 In-Game Server 계층 – 인게임 서버
게임 장르에 따라 기획에 따라 요구 사항을 정의합니다
게임 서버 구현 방식에 따라 리소스 사용량이 달라질 수도 있습니다
AmazonCloudWatch
Computing Layer
Amazon EC2 Amazon ECS AWS Lambda
Amazon EKS
CPU
Network
Memory
...
AWS Elastic
Beanstalk
AWS Fargate
41. © 2021, Amazon Web Services, Inc. or its Affiliates.
세션 기반 게임 In-Game Server 계층 – 인스턴스 선택 Tip
• 인스턴스 타입은 항상 최신 세대를 선택하는 것이 권장됩니다
• Server Authority 방식으로 구현된다면 C 타입을 고려해보실 수 있
습니다
• 인스턴스 이름에 g 가 붙은 타입은 그에 맞게 빌드될 수 있다면 보
다 나은 가격대비 성능을 제공합니다
• 인스턴스 이름에 n 이 붙은 타입은 네트워크 성능 향상에 적합하
고 높은 대역폭을 제공합니다
• 클러스터 배치 그룹(Cluster Placement Group) 은 인스턴스 간 통
신에 있어 낮은 지연 시간을 제공합니다
Amazon EC2
42. © 2021, Amazon Web Services, Inc. or its Affiliates.
세션 기반 게임 Outgame Server 계층
Game Clients Ingame Servers
Outgame Servers
Databases
Database
Cache
43. © 2021, Amazon Web Services, Inc. or its Affiliates.
세션 기반 게임 Out-Game Server 계층
API Servers
Elastic Load
Balancing
게임에 필요한 다양한 서버 계층이 포함됩니다 (아웃 게임 서버 포함)
게임 서버와 상호작용하기 위해서 API 를 제공하는 웹 서버, TCP / UDP 형태의 App 서버,
Pub/Sub 방식의 메시지 큐 사용 등이 포함됩니다
Game Master Online 2편은 아웃 게임에 사용되는 다양한 형태의 서버 구성을 소개합니다
App Servers
Game Server
Message Queue
Pub Sub
44. © 2021, Amazon Web Services, Inc. or its Affiliates.
세션 기반 게임 데이터베이스 계층
Game Clients Ingame Servers
Outgame Servers
Databases
Database
Cache
45. © 2021, Amazon Web Services, Inc. or its Affiliates.
세션 기반 게임 Database 계층
Amazon RDS Amazon
ElastiCache
Amazon
DynamoDB
Amazon Aurora
• 게임 공통 데이터에 대한
캐시 용도로 사용
• 세션 데이터를 위한 임시
저장소 (Pub/Sub)
• Redis Sorted Set 을
이용한 랭킹 대시보드
• 샤딩 및 복제 노드를 통한
확장성 및 가용성 제공
• ms 단위의 일관된 성능과
안정성을 제공하는 DB
• NoSQL 기반의 데이터
설계가 필요
• 분산 환경에서 확장성이
뛰어나고 관리가 용이
• 근래에는 게임 메인 DB 로
활용 사례가 증가
• Global DB, User DB 등 대부분
게임의 메인 데이터베이스
• 안정성을 위한 Multi AZ 및 Read-
Replica 구성이 권고
• CPU, I/O, Memory 등 각종 지표에
대한 면밀한 관리가 필요
• Aurora 는 리소스 활용도를 높여서
I/O bound 없이 확장이 가능
46. © 2021, Amazon Web Services, Inc. or its Affiliates.
세션 기반 게임 Database 계층
Database 계층에 직접 쿼리할 수도 있지만 비동기로 처리 수행도 가능한 패턴
API 서버에서 처리를 수행하도록 분리하거나 Amazon SQS 와 같은 Queue 활용이 가능
Game Servers
API Servers
Databases
Amazon
Aurora
Amazon
ElastiCache
AZ
ElastiCache
Replica Node
AZ
Aurora
Read-Replica
Amazon SQS
Consumer
Elastic Load
Balancing
47. © 2021, Amazon Web Services, Inc. or its Affiliates.
세션 기반 게임의 참고 가능한 아키텍처
Game Clients Matchmakers
Game Servers
HTTP based
Amazon
CloudFront
AWS Global
Accelerator
UDP based
Dedicated Server
Amazon SQS
Consumer
Amazon
Aurora
Amazon
ElastiCache
API Servers
Elastic Load
Balancing
Database Layer
Matchmaking
Game Server Access
Transaction
48. © 2021, Amazon Web Services, Inc. or its Affiliates.
그 외 추가적인 고려 사항들
사용자가 몰리는 시간대에 서버를 늘리고 싶습니다
전 세계 사용자들이 이용할 수 있도록 여러 지역에 게임 서버를 배포하고
싶습니다
장애에 대해 자동으로 복구되는 게임 서비스를 만들고자 합니다
매치메이킹 시스템 구현이 복잡합니다
코드 배포를 위한 인프라 구성은 어떻게 시작해야하나요?
게임 세션에 대해 모니터링하고 싶습니다
49. © 2021, Amazon Web Services, Inc. or its Affiliates.
세션 기반 게임을 위한 AWS 서비스
• 멀티 플레이어 게임을 위한 Dedicated Game Server 호
스팅 솔루션
• 대부분의 게임 플랫폼을 위한 Cross Platform 인프라
• 많은 양의 서버 용량을 쉽게 프로비저닝하고 Auto
Scaling 구성이 가능
• 코드의 손쉬운 배포와 업데이트
• 지연 시간과 플레이어 대기 시간을 최소화
• 관리형 Match making 기능의 제공
• Spot Fleet 을 사용하여 비용 효율적인 플릿 관리가 가능
AmazonGameLift
50. © 2021, Amazon Web Services, Inc. or its Affiliates.
Amazon GameLift 사용의 이점
고가용성
플레이어를 고려한
낮은 지연 시간
유연성
비용 효율적으로
게임 서버 프로비저닝
세션 기반 멀티 플레이 게임 서버를 배포 & 운영 및 확장하는데 사용 가능한 완전
관리형 서비스
51. © 2021, Amazon Web Services, Inc. or its Affiliates.
Amazon GameLift 의 다양한 서비스들
Amazon GameLift
Realtime Servers
Amazon GameLift
Custom Game Servers
Amazon GameLift
FleetIQ
• 게임을 위한 사용자 정의 서버를 위한 기본 완전 관리형 솔루션
• GameLift 통합을 통해 대부분의 사용 사례를 커버 가능
• Javascript 기반으로 쉽게 만들 수 있는 경량화된 게임 서버를 위
한 관리형 솔루션
• GameLift 의 관리형 기능을 저렴한 비용으로 이용 가능
• GameLift 의 FleetIQ 알고리즘을 이용하여 스팟 인스턴스의 활용
도를 높이면서 직접 게임 서버 호스팅을 이용하는 방식
• 호스팅 리소스를 직접 관리할 수 있는 유연함이 강점
52. © 2021, Amazon Web Services, Inc. or its Affiliates.
Amazon GameLift 기반 게임 서버 호스팅
Builds Fleets
AmazonGameLift
SDK
• 게임 서버 코드에 GameLift SDK
를 연동합니다
• 게임 클라이언트 / 프록시 서버에
도 GameLift SDK 를 연동합니다
• 게임 서버를 빌드 형태로 만듭니
다
• 여러 버전의 빌드를 만들 수 있습
니다
• 플릿은 게임 서버를 호스팅하는
인스턴스의 묶음입니다
• 게임 서버 빌드를 플릿에 업로드
합니다
53. © 2021, Amazon Web Services, Inc. or its Affiliates.
Amazon GameLift 기반의 게임 서버 배포
Build A Fleet A Client
Fleet B
Build B
Alias
New Players
Developer
GameLift 는 AWS CLI 를 통한 게임 서버 배포를 지원합니다
게임 서버는 Build 형태로 Fleet 에 배포되며, 이를 가리키는 Alias 를 만들 수 있습니다
Alias 의 전환으로 게임 서버 빌드의 블루/그린 배포가 가능합니다 (단, Alias 는 몇 분간 캐싱
됩니다)
54. © 2021, Amazon Web Services, Inc. or its Affiliates.
Amazon GameLift 동작 원리 (서버 – 클라이언트)
Game A
Player slot 1
Player slot 2
Player slot 3
Player slot 4
Active
Active
Game B
Player slot 1
Player slot 2
Player slot 3
Player slot 4
Active
Active
Active
Active
Game C
Player slot 1
Player slot 2
Player slot 3
Player slot 4
Game A Game B Game C
EC2 Instance EC2 Instance EC2 Instance
Developer Players
Session Management
Infrastructure Management
Build
Game C
Reserved
Activate
55. © 2021, Amazon Web Services, Inc. or its Affiliates.
Amazon GameLift Auto Scaling
트래픽 증가에 대해 GameLift 플릿 내 인스턴스의 수동 및 자동 스케일링이 가능합니다
Manual Scaling 을 통해 인스턴스 갯수의 목표치, 최소 갯수 및 최대 갯수 설정이 가능합니다
Auto Scaling 은 유휴 세션 비율을 버퍼링하는 Target Tacking Scaling, 지표에 따른 확장이 제
공되는 Rule based Scaling 이 제공됩니다
56. © 2021, Amazon Web Services, Inc. or its Affiliates.
Amazon GameLift 관리형 매치메이킹 (FlexMatch)
• FlexMatch 는 GameLift 에서 제공하는 관리형 매치메이킹을 지원
합니다
• JSON 형태로 정의된 Ruleset 을 기반으로 다양한 매치메이킹을
지원합니다
• 플레이어 그룹 (팀/파티/배틀로얄) 지원
• Latency 기반 매치메이킹
• 사용자 동의 기반 매치메이킹
• Backfill 을 통한 기존 매치 채우기
• 손쉽게 매치메이커를 만들 수 있지만, 정교한 매치메이킹에 적합
하지 않을 수 있습니다
Amazon GameLift
Matchmaking
Configuration
FlexMatch
Ruleset
57. © 2021, Amazon Web Services, Inc. or its Affiliates.
Amazon GameLift 대기열
GameLift 는 Queue 를 통해 최적의 Latency 를 제공하는 플릿에 플레이어들을 호스팅합니다
여러 리전의 Fleet 을 Queue 에 연결하여 글로벌 서비스 배포가 용이합니다
GameLift 는 가격, Latency, 가용률 등의 지표를 기반으로 최적의 Fleet 으로 플레이어 세션을
배치합니다
Fleet (Virginia)
Fleet (Frankfurt)
Queue
Amazon GameLift
58. © 2021, Amazon Web Services, Inc. or its Affiliates.
Amazon GameLift 와 FleetIQ 알고리즘
FleetIQ
Algorithm
• Fleet IQ 알고리즘은 Spot Interruption Rate (스팟 중단률) 이 가장
낮은 스팟 플릿에 게임 세션을 할당합니다
• 통계적으로 75,000 게임 세션 중 1 건에 대해 Spot Interruption 으
로 인한 종료가 관측됩니다
• FleetIQ 를 사용하더라도 온 디맨드 플릿은 한 개 이상 구성이 권장
됩니다
GameLift Custom Game Server
• FleetIQ 알고리즘은 GameLift Queue 에 적용됩니다
GameLift 독립형 FleetIQ
• 일반 게임 서버 Claim 시 FleetIQ 알고리즘이 적용됩니다
59. © 2021, Amazon Web Services, Inc. or its Affiliates.
Amazon GameLift 모니터링
GameLift 콘솔에서는 GameLift 리소스의 상태 모니터링을 위한 다양한 툴을 제공합니다
플릿 내의 게임 세션 상태와 플레이어 세션 상태를 모니터링할 수 있습니다
매치가 잘 되고 있는지, 플레이어가 대기열에 지나치게 많지는 않은지 등 확인이 가능합니다
60. © 2021, Amazon Web Services, Inc. or its Affiliates.
Amazon GameLift 기반의 예시 아키텍처 구성
Game Client
Amazon API
Gateway
AWS Lambda
AWS Lambda
Amazon
DynamoDB
Amazon
GameLift
Amazon SNS
Matchmaking
Configuration
Queue Alias On-demand
Fleet
Spot
Fleet
Alias
Game Access
FlexMatch Request
Match Polling
Matchmaking
Notification
Match
Update
Amazon SQS
DB Update
61. © 2021, Amazon Web Services, Inc. or its Affiliates.
Amazon GameLift 에 대한 Tip
• Amazon GameLift 는 게임 서버 구현 플랫폼이 아닙니다
• GameLift 사용 시 GameLift Local 의 사용이 권장됩니다
• FlexMatch 의 경우 완전 관리형 매치메이킹을 제공하지만 만능 매
치메이킹이 제공되지는 않습니다
• 서버 리소스를 직접 관리하시려면 GameLift 독립형 FleetIQ 를 사
용하시는 것이 좋습니다 (오버 프로비저닝 방지 및 가시성 확보)
• GameLift 로 런칭 시 Best Practice 를 참고하시는 것이 좋습니다
• FleetIQ 알고리즘은 스팟 플릿의 가용성을 올려주지만 온디맨드
플릿은 항상 필요합니다
AmazonGameLift
62. © 2021, Amazon Web Services, Inc. or its Affiliates.
Amazon GameLift 고객 사례
For Honor is Session based multiplayer
action/fighting game
Multiple modes for 1v1, 2v2, and 4v4
competitive matches
Launched on GameLift February 2018
63. © 2021, Amazon Web Services, Inc. or its Affiliates.
Amazon GameLift 고객 사례
Dead by Daylight is Session based
multiplayer horror game
Multipleplay game based onAmazon
GameLift
Migrated P2P servers to GameLift
Dedicated Servers
Launched on GameLift December 2019
64. © 2021, Amazon Web Services, Inc. or its Affiliates.
Amazon GameLift 고객 사례
MotoGP19 is Session based multiplayer racing game
First title from developer Milestone with online
multiplayer
Why the chose GameLift
• Easy to scale in regions with existing player base
• Ability to expand to new global player base
• Competitive pricing
• The AWS toolkit
65. © 2021, Amazon Web Services, Inc. or its Affiliates.
정리 : 세션 게임을 위한 AWS 의 두 가지 옵션
직접 인프라 스택을 프로비저닝해서 Dedicated Server 인프라를 구현하실 수 있습니다
Amazon GameLift 의 Custom Game Server 및 Realtime Server 는 관리형 인프라를 제공합니다
Amazon GameLift 의 독립형 FleetIQ 는 직접 인프라를 만들고 관리하면서 비용 상의 이점을 제공합니다
보다 우리 게임에 적합한 AWS 아키텍처 설계 가이드를 원하신다면
aws-gaming-korea@amazon.com 으로 연락 부탁드립니다
67. © 2021, Amazon Web Services, Inc. or its Affiliates.
Recipe & Estimate
68. © 2021, Amazon Web Services, Inc. or its Affiliates.
Recipe and Estimate
(https://calculator.aws/#/)
Scenario) Live-demo Workflow
플레이어 10만명이 하루에 10 개의 API 요청 전송. 게임 세션은 30분 지속되는 5:5 게임. 한 시간에 2만 개의
게임 플레이 & 순수 매치메이킹 하루 1시간
• GameLift 비용 (227.12 달러)
• GameLift 온디맨드 플릿 x 2 => 0.123 달러 (시간당) x 2 => 0.246 달러 (시간) => 177.12 달러
• FlexMatch (12 개월 동안 50,000 개의 플레이어 패키지 & 매월 5시간 매치메이킹 시간 무료). 하루에 매치메이킹 1시간 => 20달러(플레이어
패키지) + 30 달러 (매치메이킹 시간당 비용)
• 서버리스 백엔드 비용 (912.9 달러)
• 하루 Lambda 요청이 100만개. Lambda 함수가 1초 구동 시 메모리 비용 16.7 달러 (하루) + 요청 갯수 1백만개 => 0.20 달러 (하루)
• Lambda 함수 한달 기준 비용 => 507 달러
• 한달에 API 요청은 3,000만개. API Gateway 에서 1백만 요청 무료. => 29 x 3.5 달러(REST API) => 101.5 달러
• DynamoDB RCU 및 WCU 를 500 씩 프로비저닝 => 304.4 달러
• Total estimate : $1140.02
69. © 2021, Amazon Web Services, Inc. or its Affiliates.
Tips for the Game Masters
70. © 2021, Amazon Web Services, Inc. or its Affiliates.
AWS 계정 관리 백서
Q) Account 에 대표 메일 계정을 잃어버려서 각종 안내 메일 수신이 안됩니다.
A) 콘솔에 접속해서 My Account -> Account Settings 페이지에서 Edit 를 선택하고 사용 가능한
이메일 주소 및 전화번호를 변경하세요.
TIP) 연락처는 그룹 메일 주소 또는 항시 수신 가능한 전화 번호를 입력합니다. (담당자 변경 대비)
Notas do Editor
T 타입은 없이
Spot Fleet > 온디맨드랑 스팟 썼을 때 비용 차이
달라질 수 있다는 부분을 강조. 이건 정말 러프하게 계산한 항목인 것
GameLift 개발 초기부터 여쭤보라는 메시지!
T 타입은 없이
Spot Fleet > 온디맨드랑 스팟 썼을 때 비용 차이
달라질 수 있다는 부분을 강조. 이건 정말 러프하게 계산한 항목인 것
루트 계정이라고 불리우는 실제 계정 생성시에 입력한 내용을 고칠 수 있습니다.
반드시! 수신이 그룹 메일 주소를 입력하세요. 담당자가 변경되어도 그룹 메일 주소를 등록 해 두시면 메일을 받으실 수 있겠죠?
전화번호는 개인 번호나 수신이 불가능한 ARS 번호등을 등록하시면 큰일납니다.
왜냐하면, 루트계정 비밀번호 분실 시 임시 비밀번호를 알려주는데요, 반은 메일로, 반은 전화로 알려주거든요. 그러니 꼭!! 받으실 수 있는 번호로 넣어주세요!!
대체 연락처에 Billing, Operations, Security 3가지의 항목에 맞는 담당자 메일 주소를 넣어주세요. 그럼 각각의 항목에 대한 이벤트 등이 있을 때 입력하신 메일로 연락이 갑니다.
당연히 이 부분도 그룹 메일 주소로 하는것이 좋겠죠? 캡쳐된 부분은 잘못된 예시입니다. 제 메일 주소거든요.