SlideShare a Scribd company logo
The 7 Lessons for Highly Effective Real-time Server
G re a t Te c h n o l o g y F o r G re a t G a m e s
D K M o o n
dkmoon@ifunfactory.com
1
✓ Worked on six MMORPG game servers at Nexon from 1999 thru 2005.
✓ Left it for a better opportunity in the States.
✓ Returned to it for no better place. (unfortunately…)
✓ Worked on mobile game server framework from 2011 thru 2013.
✓ Left again to start a business in the game server software industry.
Personal Relationship with Nexon
Great Technology For Great Games
2
✓ Case studies on server-related issues and lessons from them.
✓ Reference game #1: PC MMORPG
• Peak CCU: 140K
• Peak CCU/Server: 15K
✓ Reference game #2: Mobile real-time MO game
• Being developed by Nexon/IFF and published by Tencent
• Passed 3 beta tests (CCU confidential)
About This Talk
Great Technology For Great Games
3
Game ServiceArchitecture (Data Plane)
Great Technology For Great Games
4
Game Client
Game Server
DB Server
Cache
Load balancer
/ Switch
Game ServiceArchitecture (Data Plane)
Great Technology For Great Games
5
Game Client
Game Server
DB Server
Cache
Presentation
Layer
Access
Layer
Logic/Application
Layer
Cache
Layer
Persistence
Layer
Load balancer
/ Switch
✓ Case: saturated NIC & oversubscribed network
• In the past, network interface card (NIC) could be saturated.
• This does not happen any more, but core switch can be choked.
✓ Observation
• Real-time MMO: 200-300 Bps
• REST-based mobile: 700-800 Bps w/ spikes
✓ Suggestion
• Meter your traffic
Lesson #1
Know Your Traffic Pattern
Great Technology For Great Games
6
… …
…
Core switch
✓ Case: saturated NIC & oversubscribed network
• In the past, network interface card (NIC) could be saturated.
• This does not happen any more, but core switch can be choked.
✓ Observation
• Real-time MMO: 200-300 Bps.
• REST-based mobile: 700-800 Bps w/ spikes.
✓ Suggestion
• Meter your traffic
Lesson #1
Know Your Traffic Pattern
Great Technology For Great Games
7
… …
…
Core switch
✓ Case: saturated NIC & oversubscribed network
• In the past, network interface card (NIC) could be saturated.
• This does not happen any more, but core switch can be choked.
✓ Observation
• Real-time MMO: 200-300 Bps.
• REST-based mobile: 700-800 Bps w/ spikes.
✓ Suggestion
• Meter your traffic.
• Prefer binary message format.
• Also, correlate traffic to CPU usage.
Lesson #1
Know Your Traffic Pattern
Great Technology For Great Games
8
… …
…
Core switch
✓ Case: Memory copy functions always at the top of profiling results.
✓ Reference CPU usage: 50-70%
• Too low figures: inefficient program concurrency.
• Too high figures: unnecessary memory copying, looping.
✓ Suggestion
• Pass around packets by pointer.
• Minimizing packet sizes also helps here, too.
Lesson #2
Avoid Copying Packets
Great Technology For Great Games
9
✓ Case: Memory copy functions always at the top of profiling results.
✓ Target CPU usage: 50-70%
• Too low figures: inefficient program concurrency.
• Too high figures: unnecessary memory copying, looping.
✓ Suggestion
• Pass around packets by pointer.
• Minimizing packet sizes also helps here, too.
Lesson #2
Avoid Copying Packets
Great Technology For Great Games
10
✓ Case: Memory copy functions always at the top of profiling results.
✓ Target CPU usage: 50-70%
• Too low figures: inefficient program concurrency.
• Too high figures: unnecessary memory copying, looping.
✓ Suggestion
• Pass around packets by pointer.
• Minimizing packet sizes also helps here, too.
Lesson #2
Avoid Copying Packets
Great Technology For Great Games
11
✓ Case: Adopted lightweight byte-by-byte XOR encryption.

Never being hacked into encryption algorithm.

Instead, lots of packet replay attacks and client hack attempts.
✓ Observation
• Hackers do not bother reverse-engineering encryption algorithm.
• Instead, they hack into the client and let it do the encryption job.
✓ Suggestion
• Pick a lightweight encryption algorithm as long as it can prevent
packet forgery. (Complex algorithm uses up too much CPU.)
• More focus on preventing game client manipulation.
• Also, prepare for packet replay attacks.
Lesson #3
Focus on Client Obfuscation
Great Technology For Great Games
12
✓ Case: Adopted lightweight byte-by-byte XOR encryption.

Never being hacked into encryption algorithm.

Instead, lots of packet replay attacks and client hack attempts.
✓ Observation
• Hackers do not bother reverse-engineering encryption algorithm.
• Instead, they hack into the client and let it do the encryption job.
✓ Suggestion
• Pick a lightweight encryption algorithm as long as it can prevent
packet forgery. (Complex algorithm uses up too much CPU.)
• More focus on preventing game client manipulation.
• Also, prepare for packet replay attacks.
Lesson #3
Focus on Client Obfuscation
Great Technology For Great Games
13
✓ Case: Adopted lightweight byte-by-byte XOR encryption.

Never being hacked into encryption algorithm.

Instead, lots of packet replay attacks and client hack attempts.
✓ Observation
• Hackers do not bother reverse-engineering encryption algorithm.
• Instead, they hack into the client and let it do the encryption job.
✓ Suggestion
• Pick a lightweight encryption algorithm as long as it can prevent
packet forgery. (Complex algorithm uses up too much CPU.)
• More focus on preventing game client manipulation.
• Also, prepare for packet replay attacks.
Lesson #3
Focus on Client Obfuscation
Great Technology For Great Games
14
✓ Case: Broadcasting hinders scalability in both CPU and network BW.

Refactored multiple times for visibility-based multicasting.
✓ Observation
• Along the memory copy, loop for broadcasting is the key reason for
high CPU usage.
• Such broadcasting triggers packet copies, too. (because different
players use different encryption seeds.)
✓ Suggestion
• Avoid broadcasting.
• Manage players list in a way of easy multicasting.
Lesson #4
Use Multicasting with Limited Scope
Great Technology For Great Games
15
✓ Case: Broadcasting hinders scalability in both CPU and network BW.

Refactored multiple times for visibility-based multicasting.
✓ Observation
• Along the memory copy, loop for broadcasting is the key reason for
high CPU usage.
• Such broadcasting triggers packet copies, too. (because different
players use different encryption seeds.)
✓ Suggestion
• Avoid broadcasting.
• Manage players list in a way of easy multicasting.
Lesson #4
Use Multicasting with Limited Scope
Great Technology For Great Games
16
✓ Case: Broadcasting hinders scalability in both CPU and network BW.

Refactored multiple times for visibility-based multicasting.
✓ Observation
• Along the memory copy, loop for broadcasting is the key reason for
high CPU usage.
• Such broadcasting triggers packet copies, too. (because different
players use different encryption seeds.)
✓ Suggestion
• Avoid broadcasting.
• Manage players list in a way of easy multicasting.
Lesson #4
Use Multicasting with Limited Scope
Great Technology For Great Games
17
✓ Case: Heavily relied on DB transaction for inter-server synchronization

DB gets overloaded.

Servers gets serialized for DB I/O waiting.
✓ Observation
• Many programmers overuse DB xaction for synchronization.
• DB is heavyweight to guarantee properties like ACID, which means
they pay extremely high costs for synchronization.
✓ Suggestion
• Use inter-server RPC or memory cache for synchronization.
Lesson #5
Don’t Use DB as Synchronization Point
Great Technology For Great Games
18
✓ Case: Heavily relied on DB transaction for inter-server synchronization

DB gets overloaded.

Servers gets serialized for DB I/O waiting.
✓ Observation
• Many programmers overuse DB xaction for synchronization.
• DB is heavyweight to guarantee properties like ACID, which means
they pay extremely high costs for synchronization.
✓ Suggestion
• Use inter-server RPC or memory cache for synchronization.
Lesson #5
Don’t Use DB as Synchronization Point
Great Technology For Great Games
19
✓ Case: Heavily relied on DB transaction for inter-server synchronization

DB gets overloaded.

Servers gets serialized for DB I/O waiting.
✓ Observation
• Many programmers overuse DB xaction for synchronization.
• DB is heavyweight to guarantee properties like ACID, which means
they pay extremely high costs for synchronization.
✓ Suggestion
• Use inter-server RPC or memory cache for synchronization.
Lesson #5
Don’t Use DB as Synchronization Point
Great Technology For Great Games
20
✓ Case: Intensive use of REDIS for data sharing among the servers.

REDIS quickly becomes a bottleneck.
✓ Observation
• Caching like REDIS is much lighter than DB for sure.
• But it also runs jobs to maintain persistency/consistency/
availability.
• Direct server-to-server RPC may be a better solution in some cases.
✓ Suggestion
• Mind the persistency/consistency/availability setting of cache prog.
• Consider server-to-server RPC unless caching is unavoidable.
Lesson #6
Caching is Not For Free
Great Technology For Great Games
21
✓ Case: Intensive use of REDIS for data sharing among the servers.

REDIS quickly becomes a bottleneck.
✓ Observation
• Caching like REDIS is much lighter than DB for sure.
• But it also runs jobs to maintain persistency/consistency/
availability.
• Direct server-to-server RPC may be a better solution in some cases.
✓ Suggestion
• Mind the persistency/consistency/availability setting of cache prog.
• Consider server-to-server RPC unless caching is unavoidable.
Lesson #6
Caching is Not For Free
Great Technology For Great Games
22
✓ Case: Intensive use of REDIS for data sharing among the servers.

REDIS quickly becomes a bottleneck.
✓ Observation
• Caching like REDIS is much lighter than DB for sure.
• But it also runs jobs to maintain persistency/consistency/
availability.
• Direct server-to-server RPC may be a better solution in some cases.
✓ Suggestion
• Mind the persistency/consistency/availability setting of cache prog.
• Consider server-to-server RPC unless caching is unavoidable.
Lesson #6
Caching is Not For Free
Great Technology For Great Games
23
✓ Case: Opens a service without any monitoring / operation tools.
✓ Observation
• The day of service open is the most hectic
• Also, the service on the day is the most buggy.
• Tools to understand what’s happening inside server is a must have.
• operation tools are mandatory unless you don’t want to sleep.
✓ Suggestion
• Spend enough time developing tools.
Lesson #7
Start with Tools for Server Visibility
Great Technology For Great Games
24
✓ Case: Opens a service without any monitoring / operation tools.
✓ Observation
• The day of service open is the most hectic.
• Also, the service on the day is the most buggy.
• Tools to understand what’s happening inside server is a must have.
• Operation tools are mandatory unless you don’t want to sleep.
✓ Suggestion
• Spend enough time developing tools.
Lesson #7
Start with Tools for Server Visibility
Great Technology For Great Games
25
✓ Case: Opens a service without any monitoring / operation tools.
✓ Observation
• The day of service open is the most hectic.
• Also, the service on the day is the most buggy.
• Tools to understand what’s happening inside server is a must have.
• Operation tools are mandatory unless you don’t want to sleep.
✓ Suggestion
• Spend enough time developing tools.
Lesson #7
Start with Tools for Server Visibility
Great Technology For Great Games
26
✓ Understand your traffic pattern and try to minimize it.
✓ Avoid packet copies inside server.
✓ Focus on client obfuscation instead of complex network encryption.
✓ Prefer multicasting to broadcasting. Especially, consider visibility.
✓ Avoid using DB as a synchronization point. It will collapse.
✓ Caching is not for free. Do not rely on it too much.
✓ Develop a proper tools for server visibility before opening a service.
Recap
Great Technology For Great Games
27
Survey Result for Fun
Great Technology For Great Games
28
✓ What OS for game server?
Count RateChoice
NA
No answer
Survey Result for Fun
Great Technology For Great Games
29
✓ What language for game server?
Choice Count Rate
DK Moon
dkmoon@ifunfactory.com
www.ifunfactory.com
THANKS!
G r e a t Te c h n o l o g y F o r G r e a t G a m e s , i F u n Fa c t o r y
30

More Related Content

PPTX
2016 NDC - 모바일 게임 서버 엔진 개발 후기
PDF
[KGC 2012] Online Game Server Architecture Case Study Performance and Security
PPTX
DevOps Practices: Configuration as Code
PPTX
迎接嶄新的Windows容器叢集架構:Kubernetes
PPTX
Distributed automation sel_conf_2015
PDF
SEP DevOps Ignite Talk - Packer
PDF
Ansible Introduction
PDF
Cloud Foundry Container Runtimeで快適Kubernetes運用
2016 NDC - 모바일 게임 서버 엔진 개발 후기
[KGC 2012] Online Game Server Architecture Case Study Performance and Security
DevOps Practices: Configuration as Code
迎接嶄新的Windows容器叢集架構:Kubernetes
Distributed automation sel_conf_2015
SEP DevOps Ignite Talk - Packer
Ansible Introduction
Cloud Foundry Container Runtimeで快適Kubernetes運用

What's hot (20)

PDF
CMS Tools for Developers- Owen Harris
PDF
[D2 campus seminar]웹브라우저 엔진
PPTX
The Velvet Revolution: Modernizing Traditional ASP.NET Apps with Docker
PDF
Automated Deployment with Capistrano
PDF
Liz Quilty – Security, Scaling & High End Hosting for WordPress sites
PPTX
Cloud Spanner をより便利にする運用支援ツールの紹介
PDF
Высокопроизводительный инференс глубоких сетей на GPU с помощью TensorRT / Ма...
PPTX
Windows Containers and Docker: Why You Should Care
PDF
Delivering a production Cloud Foundry Environment with Bosh | anynines
PPTX
Ansible presentation
PPTX
Introduction to Packer and Suitcase: A Packer-based OS Image Build System
PDF
Cloud infrastructures - Slide Set 6 - BOSH | anynines
PDF
Packaging et déploiement d'une application avec Docker et Ansible @DevoxxFR 2015
PPTX
Taking Docker to Dance: Continuous Delivery on AWS
PDF
Docker Birtday #5
PPTX
Noah - Robust and Flexible Operating System Compatibility Architecture - Cont...
PPTX
WindowsAzureIAAS
PPTX
NSBCon UK nservicebus on Azure by Yves Goeleven
PDF
Vespa - Tokyo Meetup #yjmu
PDF
Service Delivery Assembly Line with Vagrant, Packer, and Ansible
CMS Tools for Developers- Owen Harris
[D2 campus seminar]웹브라우저 엔진
The Velvet Revolution: Modernizing Traditional ASP.NET Apps with Docker
Automated Deployment with Capistrano
Liz Quilty – Security, Scaling & High End Hosting for WordPress sites
Cloud Spanner をより便利にする運用支援ツールの紹介
Высокопроизводительный инференс глубоких сетей на GPU с помощью TensorRT / Ма...
Windows Containers and Docker: Why You Should Care
Delivering a production Cloud Foundry Environment with Bosh | anynines
Ansible presentation
Introduction to Packer and Suitcase: A Packer-based OS Image Build System
Cloud infrastructures - Slide Set 6 - BOSH | anynines
Packaging et déploiement d'une application avec Docker et Ansible @DevoxxFR 2015
Taking Docker to Dance: Continuous Delivery on AWS
Docker Birtday #5
Noah - Robust and Flexible Operating System Compatibility Architecture - Cont...
WindowsAzureIAAS
NSBCon UK nservicebus on Azure by Yves Goeleven
Vespa - Tokyo Meetup #yjmu
Service Delivery Assembly Line with Vagrant, Packer, and Ansible
Ad

Similar to [아이펀팩토리] 2017 NDCP (20)

PDF
How to Plan for Performance and Scale for Multiplayer Games
PDF
Energy Efficient Mobile Applications with Mobile Cloud Computing ( MCC )
PPTX
GDC 2013 - Ditching the Server: Making Client-side Only Social Games
PPT
Harlan beverly gaming levels up networking ieee 10 2009
PDF
CS4344 Lecture 5: Synchronization and Cheating in P2P Games
PPTX
Online games: a real-time problem for the network
PPT
Multiplayer Games Chapter 6 Network Topologies.ppt
PDF
Scalability & Big Data challenges in real time multiplayer games
PDF
CS4344 09/10 Lecture 1: Introduction
PPT
Multiplayer Game Programming Chapter 1.ppt
PPTX
Photon Session / Unite12 Conference
PDF
How_to_build_GameServer_2
PPTX
Five Cliches of Online Game Development
PPT
3.1 teams and processes
PDF
Games on Demand: Are We There Yet?
PPTX
Video Games Style Minitheme by Slidesgo.pptx
PDF
Lecture 8 - What is Game AI? Final Thoughts
PDF
Designs, Lessons and Advice from Building Large Distributed Systems
PDF
Lets Play Together
PDF
Akka for realtime multiplayer mobile games
How to Plan for Performance and Scale for Multiplayer Games
Energy Efficient Mobile Applications with Mobile Cloud Computing ( MCC )
GDC 2013 - Ditching the Server: Making Client-side Only Social Games
Harlan beverly gaming levels up networking ieee 10 2009
CS4344 Lecture 5: Synchronization and Cheating in P2P Games
Online games: a real-time problem for the network
Multiplayer Games Chapter 6 Network Topologies.ppt
Scalability & Big Data challenges in real time multiplayer games
CS4344 09/10 Lecture 1: Introduction
Multiplayer Game Programming Chapter 1.ppt
Photon Session / Unite12 Conference
How_to_build_GameServer_2
Five Cliches of Online Game Development
3.1 teams and processes
Games on Demand: Are We There Yet?
Video Games Style Minitheme by Slidesgo.pptx
Lecture 8 - What is Game AI? Final Thoughts
Designs, Lessons and Advice from Building Large Distributed Systems
Lets Play Together
Akka for realtime multiplayer mobile games
Ad

More from iFunFactory Inc. (20)

PDF
2019 아이펀팩토리 Dev Day 세션6 아이펀엔진 운영툴 연동하기 - 장수원
PDF
2019 아이펀팩토리 Dev Day 세션5 아이펀엔진으로 만든 게임 성능 분석 및 디버깅 - 남승현
PDF
2019 아이펀팩토리 Dev Day 세션4 아이펀엔진에 MO 게임 콘텐츠 채워 넣기 - 남승현
PDF
2019 아이펀팩토리 Dev Day 세션3 아이펀엔진 개발 환경 설정하기 (Windows+ VS) - 김진욱
PDF
2019 아이펀팩토리 Dev Day 세션2 아이펀엔진 개발 환경 설정하기 (Linux + VS Code) - 김진욱
PDF
2019 아이펀팩토리 Dev Day 세션1 네트워크 프로그래밍 개론 - 문대경 대표
PDF
[MGDC] 리눅스 게임 서버 성능 분석하기 - 아이펀팩토리 김진욱 CTO
PDF
[아이펀팩토리] 2018 데브데이 서버위더스 _03 Scalable 한 게임 서버 만들기
PDF
[아이펀팩토리] 2018 데브데이 서버위더스 _01 HTML5/WebSocket으로 Pong 게임 만들기
PDF
[아이펀팩토리] 2018 데브데이 서버위더스 _02 분산 환경을 위한 ORM 개발 경험 공유
PDF
[아이펀팩토리] 2018 데브데이 서버위더스 _04 리눅스 게임 서버 성능 분석
PDF
[아이펀팩토리] 클라이언트 개발자, 서버 개발 시작하기
PPT
[아이펀팩토리]2017 NDC 강연 자료_아이펀 엔진 개발 노트
PDF
게임서버 구축 방법비교 : GBaaS vs. Self-hosting
PDF
유니티 쉐이더 단기속성
PDF
게임 서버 성능 분석하기
PDF
혼자서 만드는 MMO게임 서버
PDF
Python과 AWS를 이용하여 게임 테스트 환경 구축하기
PPTX
PC 와 모바일에서의 P2P 게임 구현에서의 차이점 비교
PPTX
Docker 로 Linux 없이 Linux 환경에서 개발하기
2019 아이펀팩토리 Dev Day 세션6 아이펀엔진 운영툴 연동하기 - 장수원
2019 아이펀팩토리 Dev Day 세션5 아이펀엔진으로 만든 게임 성능 분석 및 디버깅 - 남승현
2019 아이펀팩토리 Dev Day 세션4 아이펀엔진에 MO 게임 콘텐츠 채워 넣기 - 남승현
2019 아이펀팩토리 Dev Day 세션3 아이펀엔진 개발 환경 설정하기 (Windows+ VS) - 김진욱
2019 아이펀팩토리 Dev Day 세션2 아이펀엔진 개발 환경 설정하기 (Linux + VS Code) - 김진욱
2019 아이펀팩토리 Dev Day 세션1 네트워크 프로그래밍 개론 - 문대경 대표
[MGDC] 리눅스 게임 서버 성능 분석하기 - 아이펀팩토리 김진욱 CTO
[아이펀팩토리] 2018 데브데이 서버위더스 _03 Scalable 한 게임 서버 만들기
[아이펀팩토리] 2018 데브데이 서버위더스 _01 HTML5/WebSocket으로 Pong 게임 만들기
[아이펀팩토리] 2018 데브데이 서버위더스 _02 분산 환경을 위한 ORM 개발 경험 공유
[아이펀팩토리] 2018 데브데이 서버위더스 _04 리눅스 게임 서버 성능 분석
[아이펀팩토리] 클라이언트 개발자, 서버 개발 시작하기
[아이펀팩토리]2017 NDC 강연 자료_아이펀 엔진 개발 노트
게임서버 구축 방법비교 : GBaaS vs. Self-hosting
유니티 쉐이더 단기속성
게임 서버 성능 분석하기
혼자서 만드는 MMO게임 서버
Python과 AWS를 이용하여 게임 테스트 환경 구축하기
PC 와 모바일에서의 P2P 게임 구현에서의 차이점 비교
Docker 로 Linux 없이 Linux 환경에서 개발하기

Recently uploaded (20)

PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PDF
Categorization of Factors Affecting Classification Algorithms Selection
PDF
737-MAX_SRG.pdf student reference guides
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PDF
Exploratory_Data_Analysis_Fundamentals.pdf
PDF
86236642-Electric-Loco-Shed.pdf jfkduklg
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
communication and presentation skills 01
PDF
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
PPTX
UNIT - 3 Total quality Management .pptx
PPTX
CURRICULAM DESIGN engineering FOR CSE 2025.pptx
PDF
BIO-INSPIRED ARCHITECTURE FOR PARSIMONIOUS CONVERSATIONAL INTELLIGENCE : THE ...
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
Safety Seminar civil to be ensured for safe working.
PDF
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
Fundamentals of Mechanical Engineering.pptx
PDF
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
PPTX
introduction to high performance computing
PDF
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
Automation-in-Manufacturing-Chapter-Introduction.pdf
Categorization of Factors Affecting Classification Algorithms Selection
737-MAX_SRG.pdf student reference guides
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
Exploratory_Data_Analysis_Fundamentals.pdf
86236642-Electric-Loco-Shed.pdf jfkduklg
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
communication and presentation skills 01
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
UNIT - 3 Total quality Management .pptx
CURRICULAM DESIGN engineering FOR CSE 2025.pptx
BIO-INSPIRED ARCHITECTURE FOR PARSIMONIOUS CONVERSATIONAL INTELLIGENCE : THE ...
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Safety Seminar civil to be ensured for safe working.
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
Fundamentals of Mechanical Engineering.pptx
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
introduction to high performance computing
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems

[아이펀팩토리] 2017 NDCP

  • 1. The 7 Lessons for Highly Effective Real-time Server G re a t Te c h n o l o g y F o r G re a t G a m e s D K M o o n dkmoon@ifunfactory.com 1
  • 2. ✓ Worked on six MMORPG game servers at Nexon from 1999 thru 2005. ✓ Left it for a better opportunity in the States. ✓ Returned to it for no better place. (unfortunately…) ✓ Worked on mobile game server framework from 2011 thru 2013. ✓ Left again to start a business in the game server software industry. Personal Relationship with Nexon Great Technology For Great Games 2
  • 3. ✓ Case studies on server-related issues and lessons from them. ✓ Reference game #1: PC MMORPG • Peak CCU: 140K • Peak CCU/Server: 15K ✓ Reference game #2: Mobile real-time MO game • Being developed by Nexon/IFF and published by Tencent • Passed 3 beta tests (CCU confidential) About This Talk Great Technology For Great Games 3
  • 4. Game ServiceArchitecture (Data Plane) Great Technology For Great Games 4 Game Client Game Server DB Server Cache Load balancer / Switch
  • 5. Game ServiceArchitecture (Data Plane) Great Technology For Great Games 5 Game Client Game Server DB Server Cache Presentation Layer Access Layer Logic/Application Layer Cache Layer Persistence Layer Load balancer / Switch
  • 6. ✓ Case: saturated NIC & oversubscribed network • In the past, network interface card (NIC) could be saturated. • This does not happen any more, but core switch can be choked. ✓ Observation • Real-time MMO: 200-300 Bps • REST-based mobile: 700-800 Bps w/ spikes ✓ Suggestion • Meter your traffic Lesson #1 Know Your Traffic Pattern Great Technology For Great Games 6 … … … Core switch
  • 7. ✓ Case: saturated NIC & oversubscribed network • In the past, network interface card (NIC) could be saturated. • This does not happen any more, but core switch can be choked. ✓ Observation • Real-time MMO: 200-300 Bps. • REST-based mobile: 700-800 Bps w/ spikes. ✓ Suggestion • Meter your traffic Lesson #1 Know Your Traffic Pattern Great Technology For Great Games 7 … … … Core switch
  • 8. ✓ Case: saturated NIC & oversubscribed network • In the past, network interface card (NIC) could be saturated. • This does not happen any more, but core switch can be choked. ✓ Observation • Real-time MMO: 200-300 Bps. • REST-based mobile: 700-800 Bps w/ spikes. ✓ Suggestion • Meter your traffic. • Prefer binary message format. • Also, correlate traffic to CPU usage. Lesson #1 Know Your Traffic Pattern Great Technology For Great Games 8 … … … Core switch
  • 9. ✓ Case: Memory copy functions always at the top of profiling results. ✓ Reference CPU usage: 50-70% • Too low figures: inefficient program concurrency. • Too high figures: unnecessary memory copying, looping. ✓ Suggestion • Pass around packets by pointer. • Minimizing packet sizes also helps here, too. Lesson #2 Avoid Copying Packets Great Technology For Great Games 9
  • 10. ✓ Case: Memory copy functions always at the top of profiling results. ✓ Target CPU usage: 50-70% • Too low figures: inefficient program concurrency. • Too high figures: unnecessary memory copying, looping. ✓ Suggestion • Pass around packets by pointer. • Minimizing packet sizes also helps here, too. Lesson #2 Avoid Copying Packets Great Technology For Great Games 10
  • 11. ✓ Case: Memory copy functions always at the top of profiling results. ✓ Target CPU usage: 50-70% • Too low figures: inefficient program concurrency. • Too high figures: unnecessary memory copying, looping. ✓ Suggestion • Pass around packets by pointer. • Minimizing packet sizes also helps here, too. Lesson #2 Avoid Copying Packets Great Technology For Great Games 11
  • 12. ✓ Case: Adopted lightweight byte-by-byte XOR encryption.
 Never being hacked into encryption algorithm.
 Instead, lots of packet replay attacks and client hack attempts. ✓ Observation • Hackers do not bother reverse-engineering encryption algorithm. • Instead, they hack into the client and let it do the encryption job. ✓ Suggestion • Pick a lightweight encryption algorithm as long as it can prevent packet forgery. (Complex algorithm uses up too much CPU.) • More focus on preventing game client manipulation. • Also, prepare for packet replay attacks. Lesson #3 Focus on Client Obfuscation Great Technology For Great Games 12
  • 13. ✓ Case: Adopted lightweight byte-by-byte XOR encryption.
 Never being hacked into encryption algorithm.
 Instead, lots of packet replay attacks and client hack attempts. ✓ Observation • Hackers do not bother reverse-engineering encryption algorithm. • Instead, they hack into the client and let it do the encryption job. ✓ Suggestion • Pick a lightweight encryption algorithm as long as it can prevent packet forgery. (Complex algorithm uses up too much CPU.) • More focus on preventing game client manipulation. • Also, prepare for packet replay attacks. Lesson #3 Focus on Client Obfuscation Great Technology For Great Games 13
  • 14. ✓ Case: Adopted lightweight byte-by-byte XOR encryption.
 Never being hacked into encryption algorithm.
 Instead, lots of packet replay attacks and client hack attempts. ✓ Observation • Hackers do not bother reverse-engineering encryption algorithm. • Instead, they hack into the client and let it do the encryption job. ✓ Suggestion • Pick a lightweight encryption algorithm as long as it can prevent packet forgery. (Complex algorithm uses up too much CPU.) • More focus on preventing game client manipulation. • Also, prepare for packet replay attacks. Lesson #3 Focus on Client Obfuscation Great Technology For Great Games 14
  • 15. ✓ Case: Broadcasting hinders scalability in both CPU and network BW.
 Refactored multiple times for visibility-based multicasting. ✓ Observation • Along the memory copy, loop for broadcasting is the key reason for high CPU usage. • Such broadcasting triggers packet copies, too. (because different players use different encryption seeds.) ✓ Suggestion • Avoid broadcasting. • Manage players list in a way of easy multicasting. Lesson #4 Use Multicasting with Limited Scope Great Technology For Great Games 15
  • 16. ✓ Case: Broadcasting hinders scalability in both CPU and network BW.
 Refactored multiple times for visibility-based multicasting. ✓ Observation • Along the memory copy, loop for broadcasting is the key reason for high CPU usage. • Such broadcasting triggers packet copies, too. (because different players use different encryption seeds.) ✓ Suggestion • Avoid broadcasting. • Manage players list in a way of easy multicasting. Lesson #4 Use Multicasting with Limited Scope Great Technology For Great Games 16
  • 17. ✓ Case: Broadcasting hinders scalability in both CPU and network BW.
 Refactored multiple times for visibility-based multicasting. ✓ Observation • Along the memory copy, loop for broadcasting is the key reason for high CPU usage. • Such broadcasting triggers packet copies, too. (because different players use different encryption seeds.) ✓ Suggestion • Avoid broadcasting. • Manage players list in a way of easy multicasting. Lesson #4 Use Multicasting with Limited Scope Great Technology For Great Games 17
  • 18. ✓ Case: Heavily relied on DB transaction for inter-server synchronization
 DB gets overloaded.
 Servers gets serialized for DB I/O waiting. ✓ Observation • Many programmers overuse DB xaction for synchronization. • DB is heavyweight to guarantee properties like ACID, which means they pay extremely high costs for synchronization. ✓ Suggestion • Use inter-server RPC or memory cache for synchronization. Lesson #5 Don’t Use DB as Synchronization Point Great Technology For Great Games 18
  • 19. ✓ Case: Heavily relied on DB transaction for inter-server synchronization
 DB gets overloaded.
 Servers gets serialized for DB I/O waiting. ✓ Observation • Many programmers overuse DB xaction for synchronization. • DB is heavyweight to guarantee properties like ACID, which means they pay extremely high costs for synchronization. ✓ Suggestion • Use inter-server RPC or memory cache for synchronization. Lesson #5 Don’t Use DB as Synchronization Point Great Technology For Great Games 19
  • 20. ✓ Case: Heavily relied on DB transaction for inter-server synchronization
 DB gets overloaded.
 Servers gets serialized for DB I/O waiting. ✓ Observation • Many programmers overuse DB xaction for synchronization. • DB is heavyweight to guarantee properties like ACID, which means they pay extremely high costs for synchronization. ✓ Suggestion • Use inter-server RPC or memory cache for synchronization. Lesson #5 Don’t Use DB as Synchronization Point Great Technology For Great Games 20
  • 21. ✓ Case: Intensive use of REDIS for data sharing among the servers.
 REDIS quickly becomes a bottleneck. ✓ Observation • Caching like REDIS is much lighter than DB for sure. • But it also runs jobs to maintain persistency/consistency/ availability. • Direct server-to-server RPC may be a better solution in some cases. ✓ Suggestion • Mind the persistency/consistency/availability setting of cache prog. • Consider server-to-server RPC unless caching is unavoidable. Lesson #6 Caching is Not For Free Great Technology For Great Games 21
  • 22. ✓ Case: Intensive use of REDIS for data sharing among the servers.
 REDIS quickly becomes a bottleneck. ✓ Observation • Caching like REDIS is much lighter than DB for sure. • But it also runs jobs to maintain persistency/consistency/ availability. • Direct server-to-server RPC may be a better solution in some cases. ✓ Suggestion • Mind the persistency/consistency/availability setting of cache prog. • Consider server-to-server RPC unless caching is unavoidable. Lesson #6 Caching is Not For Free Great Technology For Great Games 22
  • 23. ✓ Case: Intensive use of REDIS for data sharing among the servers.
 REDIS quickly becomes a bottleneck. ✓ Observation • Caching like REDIS is much lighter than DB for sure. • But it also runs jobs to maintain persistency/consistency/ availability. • Direct server-to-server RPC may be a better solution in some cases. ✓ Suggestion • Mind the persistency/consistency/availability setting of cache prog. • Consider server-to-server RPC unless caching is unavoidable. Lesson #6 Caching is Not For Free Great Technology For Great Games 23
  • 24. ✓ Case: Opens a service without any monitoring / operation tools. ✓ Observation • The day of service open is the most hectic • Also, the service on the day is the most buggy. • Tools to understand what’s happening inside server is a must have. • operation tools are mandatory unless you don’t want to sleep. ✓ Suggestion • Spend enough time developing tools. Lesson #7 Start with Tools for Server Visibility Great Technology For Great Games 24
  • 25. ✓ Case: Opens a service without any monitoring / operation tools. ✓ Observation • The day of service open is the most hectic. • Also, the service on the day is the most buggy. • Tools to understand what’s happening inside server is a must have. • Operation tools are mandatory unless you don’t want to sleep. ✓ Suggestion • Spend enough time developing tools. Lesson #7 Start with Tools for Server Visibility Great Technology For Great Games 25
  • 26. ✓ Case: Opens a service without any monitoring / operation tools. ✓ Observation • The day of service open is the most hectic. • Also, the service on the day is the most buggy. • Tools to understand what’s happening inside server is a must have. • Operation tools are mandatory unless you don’t want to sleep. ✓ Suggestion • Spend enough time developing tools. Lesson #7 Start with Tools for Server Visibility Great Technology For Great Games 26
  • 27. ✓ Understand your traffic pattern and try to minimize it. ✓ Avoid packet copies inside server. ✓ Focus on client obfuscation instead of complex network encryption. ✓ Prefer multicasting to broadcasting. Especially, consider visibility. ✓ Avoid using DB as a synchronization point. It will collapse. ✓ Caching is not for free. Do not rely on it too much. ✓ Develop a proper tools for server visibility before opening a service. Recap Great Technology For Great Games 27
  • 28. Survey Result for Fun Great Technology For Great Games 28 ✓ What OS for game server? Count RateChoice NA No answer
  • 29. Survey Result for Fun Great Technology For Great Games 29 ✓ What language for game server? Choice Count Rate
  • 30. DK Moon dkmoon@ifunfactory.com www.ifunfactory.com THANKS! G r e a t Te c h n o l o g y F o r G r e a t G a m e s , i F u n Fa c t o r y 30