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
- For #464, support config for origin cluster. — committed to ossrs/srs by winlinvip 6 years ago
- For #464, support origin cluster api — committed to ossrs/srs by winlinvip 6 years ago
- For #464, query origin info and ip addresses — committed to ossrs/srs by winlinvip 6 years ago
- For #464, refine code — committed to ossrs/srs by winlinvip 6 years ago
- For #464, support config origin cluster — committed to ossrs/srs by winlinvip 6 years ago
- For #464, refine result of origin cluster api — committed to ossrs/srs by winlinvip 6 years ago
- Fix #464, support origin cluster — committed to ossrs/srs by winlinvip 6 years ago
- Fix #464, support RTMP origin cluster. 3.0.29 — committed to ossrs/srs by winlinvip 6 years ago
- For #464: Add example for origin cluster — committed to ossrs/srs by winlinvip 6 years ago
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.
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.
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