S
S
Sergey Sokolov2020-05-30 12:46:23
Computer networks
Sergey Sokolov, 2020-05-30 12:46:23

How to consolidate distributed game servers?

Let's say a simple browser quiz. Connect to the server via WebSocket and send responses.
Time game. Everyone had a question, 10 seconds to think and choose an answer.
The server accepted the answers, sent out statistics to everyone: option A: 100 people, option B: 200.

Just until 100 thousand participants break into it. You have to scale.

Multiple servers. Each maintains its own pool of WS connections == pool of players.
Player data is only in the memory of this server.

Question time is over. We need to collect general statistics between all servers and send each to our players.

What pattern(?) is there for this situation?

So far 2 options have come to mind.

  1. The servers are completely identical and equal. Know the contacts of others. Everyone sends their data to the rest, waits (for a certain time?) From the rest of their info. Summarizes, sends to its pool.
  2. Master server and slaves. The master collects information from all, sums it up, sends the total to all. Those are sent to the pool.

Which option is better and why do you think?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Armenian Radio, 2020-05-30
@sergiks

A single-layer structure, in theory, can be more stable than a dedicated server structure.

V
Vladimir Olohtonov, 2020-05-30
@sgjurano

Most likely, one server per eye is enough for such a task.
If you need to scale, then make several identical cars with a common base and a balancer in front of them.

X
xmoonlight, 2020-05-30
@xmoonlight

1. Sending answers to questions - via POST.
2. Receiving server events by the browser (new question, timer sync, who is online?) - websocket.
3. The rest is GET.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question