srs: Cluster: Origin Cluster for Fault Tolarence and Load Balance.

Currently, there can only be one origin server. When multiple edges connect to multiple origin servers, only one origin server can be selected at a given moment. Therefore, if a stream is sent to two out of N (N>=3) origin servers, such as for hot backup, there will always be one origin server without a stream. If an edge connects to this origin server, it will result in no stream. The edge will have to wait because it cannot know that the origin server does not have this stream.

From the perspective of hot backup and load balancing, it is necessary to support multiple origin servers. These origin servers need to communicate and synchronize their states. This way, when an edge connects to an origin server without a stream, the origin server can inform the edge of the correct origin server.

TRANS_BY_GPT3

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 18 (15 by maintainers)

Commits related to this issue

Most upvoted comments

Just now, when I was taking a dump, I thought of a simple solution for the origin server cluster. It can be independent of a centralized data system and rely on the client to establish flow information.

For example, if there are three origin servers, when the edge server EdgeA does not have any flow to access origin server A, it immediately accesses origin server B. If origin server B has a flow, the client requests origin server B and also informs origin server A about this information. This completes the exchange of information, making the entire origin server system stateless.

Step 1: Client request Origin A, 404 Not Found.
+-------+           +---------+
| EdgeA +------->---+ OriginA |
+-------+           +---------+


Step 2: Client request Origin B, 200 OK.
+-------+           +---------+
| EdgeA +------->---+ OriginB |
+-------+           +---------+

Step 3: Client notify Origin A where the stream is.
+-------+           +---------+
| EdgeA +------->---+ OriginA |
+-------+           +---------+

In this way, when the other edge server EdgeB connects to origin server A, origin server A knows that this flow is on origin server B, so it gives EdgeB a 302 redirect to origin server B. This means that once the information is established, other edge servers only need a single 302 redirect to know which origin server the flow is on.

Step 1: Client request Origin A, 302 to Origin B.
+-------+           +---------+
| EdgeB +------->---+ OriginA |
+-------+           +---------+


Step 2: Client request Origin B, 200 OK.
+-------+           +---------+
| EdgeB +------->---+ OriginB |
+-------+           +---------+

If the edge server finds that the flow does not exist when accessing the second origin server, it informs the first origin server and starts the polling process again. In this system, the worst-case scenario requires polling all the origin servers, but this process can be done very quickly because the network between the edge server and the origin server is generally very good.

Regardless of which origin server crashes or if the flow is pushed to a different origin server, the system will be rebuilt and this process does not require synchronizing all the origin servers.

TRANS_BY_GPT3