ossrs / srs

SRS is a simple, high-efficiency, real-time media server supporting RTMP, WebRTC, HLS, HTTP-FLV, HTTP-TS, SRT, MPEG-DASH, and GB28181.
https://ossrs.io
MIT License
25.24k stars 5.32k forks source link

OriginCluster: Same stream may exist in two origin servers. #2789

Open jinleileiking opened 2 years ago

jinleileiking commented 2 years ago

Description'

Please ensure that the markdown structure is maintained.

  1. SRS version: 4.0'

Please ensure that the markdown structure is maintained.

  1. The configuration of SRS is as follows (Config):

Please ensure that the markdown structure is maintained.

To form a cluster with 2 origins and 2 edges, use statefulsets for the 2 origins and deployments for the 2 edges. Expose port 1935 for the edges using a load balancer.

Please ensure that the markdown structure is maintained.

Replay

Please ensure that the markdown structure is maintained.

Translation:

First, let's assume the path used is e1 -> o1. If we try to push the same flow again, the path remains e1. However, since it reaches the same machine, it cannot be pushed up, which is expected. Now, let's consider the path e2 -> o1. Since o1 cannot be pushed up, it also meets the expected outcome. Continuing with persistent attempts, finally, there is one instance where the path used is e2 -> o2. Since o2 does not have to go to coworker o1 to find the flow, it can also be pushed up.

Please ensure that the markdown structure is maintained.

Translation:

Is this problem not being resolved because it involves central states? Or is it considered to be reasonable?

Please ensure that the markdown structure is maintained.

Translation:

The way to solve this problem is also very simple: just use on_publish to obtain the stream status from the central service.

Please ensure that the markdown structure is maintained.

Translation:

Alternatively, you can add o1 to o2... the logic of checking if the stream exists in other origin servers.

Please ensure that the markdown structure is maintained.

TRANS_BY_GPT3

winlinvip commented 2 years ago
Crazy push, finally there was a time when using e2 -> o2 because o2 did not reach coworker o1 to find the flow, so it also pushed up.

Why did o2 not reach o1 to find the flow? Is there a simple way to reproduce it?

TRANS_BY_GPT3

jinleileiking commented 2 years ago

Why is there no flow from o2 to o1? Is there a simple way to reproduce this path?

The streaming is pushed to O2, but O2 does not have the code logic to search for this stream in coworker O1.

The reproduction path is as I described:

  SLB  ---  E1   O1   
         |.                
         |.--E2  O2

Configuration:

Origin:

        cluster {
            origin_cluster  on;
            coworkers       srs-origin-0.srs-origin-service srs-origin-1.srs-origin-service;
        }

Edge:

        cluster {
            mode            remote;
            origin          srs-origin-0.srs-origin-service srs-origin-1.srs-origin-service;
        }

Crazy to push a stream to SLB, you can reproduce it.

The origin configuration of Edge is used for communication with the origin load balancer. The coworker of the origin is used by Edge to fetch the origin and return a 302 response.

When there is no publishing of streams, the origin does not check the existence of other coworkers for this stream.

TRANS_BY_GPT3