cs4344 lecture 8: hybrid architecture
DESCRIPTION
TRANSCRIPT
Hybrid Architecturefor Networked Games
1
singlecentralized
server
completelydecentralized
2
P2P with Central Arbiter
3
A trusted central arbiter receives all game traffic and resolve conflicts if necessary.
4
Benefits ofP2P + Arbiter
5
low latency among players
6
have trusted authority now
7
Drawbacks ofP2P + Arbiter
8
limited scalability
arbiter becomes bottleneck
9
Mirrored ServersArchitecture
10
Multiple servers, each replicating the complete game states, serve clients from different geographical regions. Each client connects to one server.
11
Servers may be connected with high speed, provisioned networked, reducing synchronization latency among the servers.
12
Updates from a client are sent to its server, which then forwards it to other servers. The servers then forward the updates to all relevant clients.
13
P2P-style state synchronization among servers is easier, since 1. servers can be trusted2. clocks can be synchronized3. IP multicast may be used4. higher availability5. shorter delay
14
Benefits ofMirrored Servers
15
no single point of failures
A client can use another replicated server if their nearest server fails.
16
increase total network capacity
good if networking bandwidth is the bottleneck
17
lower latency between client and server
18
Drawbacks ofMirrored Servers
19
latency between players increases
due to additional forwarding
20
cannot scale to large world
each server still keeps the complete states
21
how to assign players to servers?
22
Assigning players to closest servers may lead to overloaded servers.
23
Assigning players to remote servers may increase end-to-end latency.
24
But we only care about latency between players that are relevant to each other.
25
An Open Problem
26
let
AOI(p) be the set of players relevant to pS(p) be the server of player pd(i,j) be the delay between i and jP(s) be the set of players assigned to server s
27
let
L(p) be the average latency experience by p, considering only relevant players
28
want to find S() such that
maximum L(p) is minimized over all p
subjected to
maximum P(s) is constrained for all s
29
Zoned ServersArchitecture
30
Divide the game world into independent regions. One server is in-charged of one region.
31
A client connects to the server serving its current region, and is handed-off to another server when it moves to another region.
32
Servers seldom communicate with each other.
33
Updates from a client are sent to its server, which then forwards it to all relevant clients in the same region.
34
35
Advantages of Zoned Servers
36
Can scale to large world
Just add more servers
37
Drawbacks of Zoned Servers
38
Single point of failures
(But can deploy mirrors for each region)
39
Constrained Game Designs
40
Supporting Seamless Game Worlds
41
Divide the game world into regions. One server is in-charged of one region.
42
Player may move around the world seamlessly
43
A client may see events and objects from neighboring regions.
44
Events occurring in one region may affectobjects in another region.
45
Advantage: Partitioning is transparent to the players. No artificial constraints in game design.
46
Advantage: We can now resize the regions to load-balance among the servers, improving server utilization.
47
A client connects to the server serving its current region, and is handed-off to another server when it moves to another region.
48
Server communicates with each other to transfer states, update states etc.
49
Updates from a client are sent to its server, which then forwards it to all relevant clients in the same region or neighboring regions.
50
or
51
A client connects to the servers serving its current region and regions it subscribes to. Updates from neighboring server are sent directly.
52
Q: How to partition the game world?
53
Ideally: each server should handle the same
number of players
54
Ideally: minimize communications between servers
55
Ideally: minimize the number of hand offs
56
Idea: divide the game world into small cells and assign group of
cells to servers.
57
58
2 0 3
3 1 4
011
I will simplify the representation to a grid of cells with number indicating the number of players (or loadincurred on server) in this cell.
59
Centralized approach to partitioning
60
Balanced Deployment Algorithm
by Bart De Vleeschauwer et al
61
Idea: sort the cells and assign them one-by-one, highest load first, to the servers to minimize
the maximum server load
62
2 0 3
3 1 4
011
Suppose we have only two servers (blue and red).
63
2 0 3
3 1 4
011
Blue’s load = 4 Red’s load = 0
64
2 0 3
3 1 4
011
Blue’s load = 4 Red’s load = 3
65
2 0 3
3 1 4
011
Blue’s load = 4 Red’s load = 6
66
2 0 3
3 1 4
011
Blue’s load = 6 Red’s load = 6
67
2 0 3
3 1 4
011
Blue’s load = 8 Red’s load = 7
68
2 0 3
3 1 4
011
Problem: neighboring cells are not adjacent. There are 8 “borders” in this solution. Communication
overhead is not considered.
69
Let’s define a cost function for assigning a cell c to a server S:
cost(c,S) = computation load increase in S + communication load increase in S
70
For simplicity, CPU load = players,
newtork load = borders
71
Clustered Deployment Algorithm
by Bart De Vleeschauwer et al
72
Start with each cell as one cluster
73
Repeatedly merge two adjacent clusters with least overhead until
number of clusters equals to number of servers.
74
2 0 3
3 1 4
011
75
2 0 3
3 1 4
011
Least cost = 1 + 3 = 4
76
2 0 3
3 1 4
011
Least cost = 2 + 3 = 5
77
2 0 3
3 1 4
011
Least cost = 1 + 5 = 6
78
2 0 3
3 1 4
011
Least cost = 3 + 5 = 8
79
2 0 3
3 1 4
011
80
Just a heuristic
the optimization problem is NP-complete
81
Last few steps involve heavily loaded cells and can create
uneven deployment.
82
We can tweak this heuristic in many ways to improve it, but it’s
still a heuristic.
83
Simulated Annealing by Bart De Vleeschauwer et al
84
A general method for finding good solution in an optimization
problem (meta-heuristic)
85
At every step, move towards a nearby, better configuration probabilistically (allowing a move towards worse solution, prevent stuck at local minimum)
86
cost
config
87
Start with a solution from a heuristic.
88
Move to a nearby config:swap cells with an adjacent
server, or move cell from one server to another
89
Is it a better solution?If so, keep it as current solution
with some probability.
90
2 0 3
3 1 4
011
91
Experimental results show that Simulated Annealing works best
among the methods.
92
Disadvantages of centralized approach
93
Expensive to compute a good solution
94
How frequent should the world be repartitioned?
95
Localized World Partitioning
96
Idea: Only repartition locally if a server is overloaded. Look for a
lightly loaded server to shed some load to.
97
overload
safe
light
98
overload
safe
light
Overloaded server sheds load until it’s load is below a safe level. The new load of a previously lightly loaded should remain below safe level.
99
l + o - s < sl < 2s - o
100
Who to shed to?
101
Minimize overhead: try to shed to as few neighboring server as
possible
102
Migrate cells to neighboring servers that are not overloaded
103
Overload = 10, Safe = 7, Light = 4
2 0 3
1 1 4
035
0 1 1
104
Green server is overloaded. Shed some load to neighbors.
2 0 3
1 1 4
035
0 1 1
105
If still not enough, look at the list of lightly loaded servers maintained. Pick the least load and shed to it.
106
Green server is still overloaded. Neighbor (purple) server has hit the safe threshold.
2 0 3
1 1 4
035
0 1 1
107
Shed load to remote server. But this could lead to high communication cost.
2 0 3
1 1 4
035
0 1 1
108
When communication overhead is too high, isolated cells can be migrated to a nearby server, “merging” with neighboring regions to form contiguous regions, as long as the load remains below the safe threshold.
2 0 3
1 1 0
031
0 1 1
109
Another Open Problem
110
No consideration on hand offs
111
Idea: If traffic is high between point A and point B, then A and B should be managed by the same
server.
112
3 2
10
0 2
42
1 1
1
2
2
4
2
2
1
113
3 2
10
0 2
42
1 1
1
2
2
4
2
2
1
Minimizing hand-off means finding minimum cuts.
114
3 2
1
2
421
2
2
4
2
2
Minimizing hand-off means finding minimum cuts.
115
3 2
1
2
42
24
2
2
Minimizing hand-off means finding minimum cuts.
116
Question: how to combine the three objectives:
1. limiting number of players2. reduce communication cost3. reduce number of hand offs
117