SlideShare a Scribd company logo
1
TECH×GAME COLLEGE#32
2
3
2007 6 13
XR (VR, AR, MR )
▸
▸ 2011
▸ 2015 R&D
4
5
, , ,
ARK
ArkPubSub Server
6
7
2 VS 2
8
9
10
1 VS 1
2 ?
11
2
COPY
COPY
4
▸
▸
12
.
OS 

13
14
15
16
HTTP API
17
18


19
20
COPY
COPY
21
COPY
COPY
▸
▸
▸
▸
22
▸
▸
▸
▸
▸
▸
23
24
25
26
27
, 1
28
29
COPY
COPY
30
COPY
COPY




31
COPY
COPY






32
33
34
35
36
▸
▸
▸
37
38
▸
▸
▸
▸
▸
39
40
41
▸
▸
▸
▸
42
▸
▸
▸
▸
▸
43
44
/CHATROOM/AAA
A
B
C
D
PubSub
Subscribe
45
/CHATROOM/AAA
A
B
C
D
PubSub
Publish
46
/CHATROOM/AAA
/TOPIC/BBB
A
B
C
D
PubSub
Subscribe
47
A
B
C
D
PubSub
Publish
/CHATROOM/AAA
/TOPIC/BBB
▸
▸
▸
48
Room/1234
A
B
C
PubSub
Topic
Room/1234
Room/1234/User/A
A
B
C
PubSub
Room/1234/User/B
Room/1234/User/C
Topic
Room/1234
Room/1234/User/A
A
B
C
PubSub
Room/1234/User/B
Room/1234/User/C
Topic
Topic Subscribe
Room/1234/User/D
D
▸
▸
▸
52
▸
▸
▸
53
▸
▸
▸
▸
54
55
ranch
ErlangVM
56
ranch
ErlangVM
session
<0.99.0>
57
ranch
ErlangVM
session
<0.99.0>
Topic/AA <0.80.0>ETS
58
ranch session
<0.99.0>
ErlangVM
Write <0.99.0>
Topic/AA <0.80.0>ETS
59
ranch
ErlangVM
Topic/AA <0.80.0>, <0.99.0>
session
<0.99.0>
ETS
ranch
ErlangVM
Topic/AA <0.80.0>, <0.99.0>
session
<0.99.0>
ETS
60
61
ranch session
<0.99.0>
ErlangVM
link
Topic/AA <0.80.0>, <0.99.0>
Read session
<0.80.0>
Send
ETS
62
ranch session
<0.99.0>
ErlangVM
link
Topic/AA <0.80.0>, <0.99.0>
Read session
<0.80.0>
Send
ETS
63
64
▸
▸
▸
▸
65
66
1bit 16
MsgType DUP QoS Retain length
MSB LSB
Payload
Protocol Version
User
Name
Pass

word
Will
retain
Will QoS Will
Clean
session
Keepalive MSB Keepalive LSB
▸
▸
▸
67
▸
▸
▸
▸
68
69
1 bit 16 32
Type ( ) Length ( )
SenderTimestamp ( ) ※
ReceiverTimesamp ( ) ※
Payload ( )
70
1 16 32
SectionType SectionLength
Value
71
1 16 32
Type Length
SenderTimestamp
ReceiverTimesamp
Payload
72
1 16 32
Type Length
SenderTimestamp
ReceiverTimesamp
SectionType SectionLength
Value
73
1 16 32
Type Length
SenderTimestamp
ReceiverTimesamp
SectionType SectionLength
Value
SectionType SectionLength
Value
▸
▸
▸
74
75
CONNECT / CONNECT TOKEN RECONNECT TOKEN
CONNACK SUCCESS CONNACK FAILED / CONNACK FAILED UNAVAILABLE etc
DISCONNECT SUBSCRIBE
UNSUBSCRIBE PUBLISH / PUBLISH ASYNC
PUBLISHED / PUBLISHED ASYNC INFO SUBSCRIBER REQUEST
RTT NOTIFY START / RTT NOTIFY STOP MESSAGE ACK
RESEND REQUEST PING REQUEST / PING RESPONSE
TIME REQUEST / TIME RESPONSE
DGRAM SETUP REQUEST / DGRAM SETUP REQUEST RECEIVED /
DGRAM SETUP COMPLETE
DGRAM REFRESH / DGRAM RE-SETUP REQUEST DGRAM DISCONNECT
ADD SUBSCRIBER / REMOVE SUBSCRIBER
SUBSCRIBE PERMISSION ERROR 

/ PUBLISH PERMISSION ERROR
INFO SUBSCRIBER INFO CLIENT RTT
76
1 16 32
Type: Subscribe (0x0400) Length
SenderTimestamp
ReceiverTimesamp
SectionType: MessageID (0x0400) SectionLength: 0x0004
Value: 0x00000001
SectionType: Topic (0x0002) SectionLength
Value: topic/AAA (UTF-8)
▸
▸
▸
77
78
1 bit 16 32
Type ( ) Length ( )
SenderTimestamp ( ) ※
ReceiverTimesamp ( ) ※
Payload ( )
79
Client
Timer
Timer1ms
1000ms
Sender
1
Receiver
301 1300ms
321ms
PubSub
300ms
80
Client
Timer Timer
1
1000
Sender Receiver
1 0 ※
Sender Receiver
1300 301 1300
321
421
Sender Receiver
421 1400
1420
521
1520Sender Receiver
521 1500
PubSub
▸
▸
81
82
83
▸
▸
▸
▸
▸
84
85
ELB
App
Job
MQ
Batch
log
▸
▸
▸
▸
86
87
PubSub
App
Battle
HTTP API
Ark
88
App
1. game start API
2. IP:Port, Token, Topic
3. Connect Token
4. Token 5. OK
6. OK
HW
89
90
App
PubSub
PubSub
PubSub
HTTP API
A 2019-01-01 00:00:00 alive
B 2019-01-01 00:00:00 alive
C 2019-01-01 00:00:00 alive
-4 sec
-4 sec
-4 sec
(5 1 ) API API
RDBMS ,
91
App
PubSub
PubSub
PubSub
HTTP API
A 2019-01-01 00:00:00 dead
B 2019-01-01 01:00:00 alive
C 2019-01-01 01:00:00 aliveA
B
C
-3604 sec
-4 sec
-4 sec
92
App
PubSub
PubSub
PubSub
HTTP API
A 2019-01-01 00:00:00 dead
B 2019-01-01 01:00:00 alive
C 2019-01-01 01:00:00 aliveA
B
C
-3604 sec
-4 sec
-4 sec
93
App
PubSub
PubSub
PubSub
HTTP API
A 2019-01-01 00:00:00 dead
B 2019-01-01 01:00:00 alive
C 2019-01-01 01:00:00 aliveA
B
C
-3604 sec
-4 sec
-4 sec
94
App
PubSub
PubSub
PubSub
HTTP API
A 2019-01-01 00:00:00 dead
B 2019-01-01 01:00:00 alive
C 2019-01-01 01:00:00 aliveA
B
C
-3604 sec
-4 sec
-4 sec
▸
95
96
App
Connection
1. heartbeat 2. OK
Server A
Server B
RoomA Server A
97
App
Connection
1. heartbeat 2. OK
Server A
Server B
RoomA Server A
98
App
1. RoomA Server?
2. Server B IP, Port …
Server A
Server B
RoomA Server B
Connection
A
99
100
App
Connection
1. heartbeat 2. OK
Server A
Server B
RoomA Server A
101
App
Connection
1. heartbeat 2. OK
Server A
Server B
RoomA Server A
1. RoomA Server?
2. Server B IP, Port …
102
App
Connection
1. heartbeat 2. OK
Server A
Server B
RoomA Server B
1. RoomA Server?
2. Server B IP, Port …
Connection
▸
▸
▸
▸
103
104
▸
▸
▸
▸
▸
105
▸
▸
▸
▸
▸
106
107
Locust Slaves
x8
Locust Master
m4.2xlarge
CPU: 8
RAM: 32GB
m4.xlarge
CPU: 4
RAM: 16GB
PubSub
108
PubSub
1 1
8 x 8 = 64
109
user/room 8
message/user/sec 0.2 waittime[ms]5000
rooms 100 1000 2000 3000 3500 3750
( ) users 800 8000 16000 24000 28000 30000
( ) message/sec 1280 12800 25600 38400 44800 48000
( ) message/sec 1270 12783 25560 38328 44787 21054
(Server)CPU [%] 66.5 360.4 404.7 560.9 635.8 444.4
(Server)RAM [%] 0.6 2.4 3.7 6.2 7.2 16.5
RTT Med [ms] 1 2 5 12 19 34
RTT Avg [ms] 14 11 12 14 27 1260
RTT Max [ms] 44 49 75 356 536 62798
End to End Med [ms] 1 3 8 18 39 460
End to End Avg [ms] 2 12 13 21 50 3017
End to End Max [ms] 747 738 754 1003 1315 100979
66.5 360.4 404.7 560.9 635.8 444.4
1270 12783
25560
38328
44787
21054
0
100
200
300
400
500
600
700
800
0
10000
20000
30000
40000
50000
60000
70000
80000
800 8000 16000 24000 28000 30000
8user/room	1msg/5s
(Server)CPU	[%] ( )	message/sec
110
user/room 8
message/user/sec 1 waittime[ms]1000
rooms 100 400 800 900 1000
( ) users 800 3200 6400 7200 8000
( ) message/sec 6400 25600 51200 57600 64000
( ) message/sec 6360 25527 48195 53240 25154
(Server)CPU [%] 275.8 618.3 709.3 774.7 766.7
(Server)RAM [%] 0.5 1.1 2.7 3 11.2
RTT Med [ms] 1 1 5 12 5
RTT Avg [ms] 10 7 24 40 494
RTT Max [ms] 45 48 491 1100 34295
End to End Med [ms] 2 11 36 80 310
End to End Avg [ms] 10 13 54 120 970
End to End Max [ms] 554 550 981 2923 44120
275.8
618.3
709.3
774.7 766.7
6360
25527
48195
53240
25154
0
100
200
300
400
500
600
700
800
0
10000
20000
30000
40000
50000
60000
70000
80000
800 3200 6400 7200 8000
8user/room	1msg/s
(Server)CPU	[%] ( )	message/sec
111
user/room 8
message/user/sec 15 waittime[ms]66.6666666666667
rooms 10 50 70 80 90 100
( ) users 80 400 560 640 720 800
( ) message/sec 9600 48000 67200 76800 86400 96000
( ) message/sec 9096 46047 58600 60764 63539 26390
(Server)CPU [%] 229.8 694.7 776.6 775.6 787.9 786.2
(Server)RAM [%] 0.4 0.5 0.6 0.7 0.7 8
RTT Med [ms] 38 2 7 10 15 24
RTT Avg [ms] 30 14 15 17 23 194
RTT Max [ms] 45 67 93 122 522 20686
End to End Med [ms] 19 19 24 33 46 73
End to End Avg [ms] 18 21 27 37 50 293
End to End Max [ms] 618 631 657 718 1231 39470
229.8
694.7
776.6 775.6 787.9 786.2
9096
46047
58600
60764
63539
26390
0
100
200
300
400
500
600
700
800
0
10000
20000
30000
40000
50000
60000
70000
80000
80 400 560 640 720 800
8user/room	15msg/s
(Server)CPU	[%] ( )	message/sec
TCP
5 MESSAGE / SEC
112
▸
▸
113
▸
▸
▸ 

114
115
user/room 8
message/user/sec 0.2 waittime[ms]5000
rooms 100 2000 3750 6250 7500 8750
( ) users 800 16000 30000 50000 60000 70000
( ) message/sec 1280 25600 48000 80000 96000 112000
( ) message/sec 1281 25639 48124 78742 94555 97731
(Server)CPU [%] 46.9 312.2 426.8 625 723.2 718
(Server)RAM [%] 2 6.8 9.8 14 17.3 18.7
1281
25639
48124
78742
94555 97731
0
100
200
300
400
500
600
700
800
0
20000
40000
60000
80000
100000
120000
140000
160000
800 16000 30000 50000 60000 70000
8user/room	1msg/5s
(Server)CPU	[%] ( )	message/sec
116
user/room 8
message/user/sec 1 waittime[ms]1000
rooms 100 400 800 1000 1200 1400 1600
( ) users 800 3200 6400 8000 9600 11200 12800
( ) message/sec 6400 25600 51200 64000 76800 89600 102400
( ) message/sec 6356 25472 51202 63890 75912 88143 99033
(Server)CPU [%] 139.4 269.1 425 500.3 625.8 699.2 765.3
(Server)RAM [%] 2 3.6 5 5 5.2 5.2 6.6
6356
25472
51202
63890
75912
88143
99033
0
100
200
300
400
500
600
700
800
0
20000
40000
60000
80000
100000
120000
140000
160000
800 3200 6400 8000 9600 11200 12800
8user/room	1msg/s
(Server)CPU	[%] ( )	message/sec
117
user/room 8
message/user/sec 15 waittime[ms]66.6666666666667
rooms 10 50 70 80 90 100 110 120 130 140
( ) users 80 400 560 640 720 800 880 960 1040 1120
( ) message/sec 9600 48000 67200 76800 86400 96000 105600 115200 124800 134400
( ) message/sec 8912 45967 64648 74035 83211 91581 99596 106775 112889 116739
(Server)CPU [%] 161.5 374.2 489.7 535.8 582.1 632.1 666.4 703.7 726.9 784.7
(Server)RAM [%] 2.1 2.3 2.3 2.3 2.3 2.2 1.8 2.6 3 3.4
8912	
45967	
64648	
74035	
83211	
91581	
99596	
106775	
112889	116739	
0%	
100%	
200%	
300%	
400%	
500%	
600%	
700%	
800%	
0	
20000	
40000	
60000	
80000	
100000	
120000	
140000	
10	 50	 70	 80	 90	 100	 110	 120	 130	 140	
8user/room	15msg/s	
(Server)CPU	[%]	 ( )	message/sec
10 MESSAGE / SEC
118
▸
▸
▸ 

▸
119
▸
▸
▸
120
121

More Related Content

PDF
オンラインゲームの仕組みと工夫
PDF
新入社員のための大規模ゲーム開発入門 サーバサイド編
PPTX
リアルタイムサーバー 〜Erlang/OTPで作るPubSubサーバー〜
PDF
TLS, HTTP/2演習
PDF
UniTask入門
PPTX
CEDEC2019 大規模モバイルゲーム運用におけるマスタデータ管理事例
PDF
MagicOnion入門
PDF
導入から 10 年、PHP の trait は滅びるべきなのか その適切な使いどころと弱点、将来について
オンラインゲームの仕組みと工夫
新入社員のための大規模ゲーム開発入門 サーバサイド編
リアルタイムサーバー 〜Erlang/OTPで作るPubSubサーバー〜
TLS, HTTP/2演習
UniTask入門
CEDEC2019 大規模モバイルゲーム運用におけるマスタデータ管理事例
MagicOnion入門
導入から 10 年、PHP の trait は滅びるべきなのか その適切な使いどころと弱点、将来について

What's hot (20)

PDF
テスト文字列に「うんこ」と入れるな
PDF
[CEDEC 2021] 運用中タイトルでも怖くない! 『メルクストーリア』におけるハイパフォーマンス・ローコストなリアルタイム通信技術の導入事例
PDF
【Unite Tokyo 2019】Unityだったら簡単!マルチプレイ用ゲームサーバ開発 ~実践編~
PDF
マイクロサービスに至る歴史とこれから - XP祭り2021
PPTX
RPGにおけるイベント駆動型の設計と実装
PDF
ゲームの仕様書を書こうまとめ
PDF
「龍が如く7 光と闇の行方」の自動テスト活用事例とテスト自動化チーム(仮)による若手育成の取り組みについて
PDF
ドメイン駆動設計をゲーム開発に活かす
PDF
ネットワーク ゲームにおけるTCPとUDPの使い分け
PDF
なぜ初心者は webpackが解らないのか?- Why can’t you understand the webpack? -
PDF
【Unity】 Behavior TreeでAIを作る
PPTX
分散トレーシングAWS:X-Rayとの上手い付き合い方
PDF
PlaySQLAlchemy: SQLAlchemy入門
PDF
分散トレーシング技術について(Open tracingやjaeger)
PDF
マルチテナントのアプリケーション実装〜実践編〜
PDF
大規模ソーシャルゲーム開発から学んだPHP&MySQL実践テクニック
PDF
RESTful Web アプリの設計レビューの話
PDF
Djangoフレームワークのユーザーモデルと認証
PDF
ドメイン駆動設計 ( DDD ) をやってみよう
PDF
CEDEC 2018 最速のC#の書き方 - C#大統一理論へ向けて性能的課題を払拭する
テスト文字列に「うんこ」と入れるな
[CEDEC 2021] 運用中タイトルでも怖くない! 『メルクストーリア』におけるハイパフォーマンス・ローコストなリアルタイム通信技術の導入事例
【Unite Tokyo 2019】Unityだったら簡単!マルチプレイ用ゲームサーバ開発 ~実践編~
マイクロサービスに至る歴史とこれから - XP祭り2021
RPGにおけるイベント駆動型の設計と実装
ゲームの仕様書を書こうまとめ
「龍が如く7 光と闇の行方」の自動テスト活用事例とテスト自動化チーム(仮)による若手育成の取り組みについて
ドメイン駆動設計をゲーム開発に活かす
ネットワーク ゲームにおけるTCPとUDPの使い分け
なぜ初心者は webpackが解らないのか?- Why can’t you understand the webpack? -
【Unity】 Behavior TreeでAIを作る
分散トレーシングAWS:X-Rayとの上手い付き合い方
PlaySQLAlchemy: SQLAlchemy入門
分散トレーシング技術について(Open tracingやjaeger)
マルチテナントのアプリケーション実装〜実践編〜
大規模ソーシャルゲーム開発から学んだPHP&MySQL実践テクニック
RESTful Web アプリの設計レビューの話
Djangoフレームワークのユーザーモデルと認証
ドメイン駆動設計 ( DDD ) をやってみよう
CEDEC 2018 最速のC#の書き方 - C#大統一理論へ向けて性能的課題を払拭する
Ad

Similar to 【TECH×GAME COLLEGE#32】ゼロからリアルタイムサーバーを作るまで (20)

PDF
LISA2019 Linux Systems Performance
PDF
PPTX
Performance Risk Management
PPTX
WebRTC for Managers!
PDF
Linux Performance 2018 (PerconaLive keynote)
PDF
ATO Linux Performance 2018
PDF
Kauli SSPにおけるVyOSの導入事例
PPTX
Debugging linux issues with eBPF
PDF
Compile ahead of time. It's fine?
PDF
Big Data & Hadoop
PDF
[INSIGHT OUT 2011] A23 database io performance measuring planning(alex)
PDF
Ficstar Software: Cassandra Installation to Optimization
PDF
YOW2020 Linux Systems Performance
PDF
Debugging Ruby
PDF
A close encounter_with_real_world_and_odd_perf_issues
PPT
vBACD - Introduction to Opscode Chef - 2/29
PPT
16aug06.ppt
PPTX
Top-5-production-devconMunich-2023-v2.pptx
PDF
Особенности архитектуры и траблшутинга маршрутизаторов серии ASR1000
PDF
Building scalable web socket backend
LISA2019 Linux Systems Performance
Performance Risk Management
WebRTC for Managers!
Linux Performance 2018 (PerconaLive keynote)
ATO Linux Performance 2018
Kauli SSPにおけるVyOSの導入事例
Debugging linux issues with eBPF
Compile ahead of time. It's fine?
Big Data & Hadoop
[INSIGHT OUT 2011] A23 database io performance measuring planning(alex)
Ficstar Software: Cassandra Installation to Optimization
YOW2020 Linux Systems Performance
Debugging Ruby
A close encounter_with_real_world_and_odd_perf_issues
vBACD - Introduction to Opscode Chef - 2/29
16aug06.ppt
Top-5-production-devconMunich-2023-v2.pptx
Особенности архитектуры и траблшутинга маршрутизаторов серии ASR1000
Building scalable web socket backend
Ad

Recently uploaded (20)

PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Big Data Technologies - Introduction.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
A Presentation on Artificial Intelligence
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
KodekX | Application Modernization Development
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Approach and Philosophy of On baking technology
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
Mobile App Security Testing_ A Comprehensive Guide.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Big Data Technologies - Introduction.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
A Presentation on Artificial Intelligence
NewMind AI Weekly Chronicles - August'25 Week I
Review of recent advances in non-invasive hemoglobin estimation
Per capita expenditure prediction using model stacking based on satellite ima...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Encapsulation_ Review paper, used for researhc scholars
KodekX | Application Modernization Development
CIFDAQ's Market Insight: SEC Turns Pro Crypto
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Chapter 3 Spatial Domain Image Processing.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Approach and Philosophy of On baking technology
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
The Rise and Fall of 3GPP – Time for a Sabbatical?

【TECH×GAME COLLEGE#32】ゼロからリアルタイムサーバーを作るまで