Clustering

OvenMediaEngine supports clustering and ensures High Availability (HA) and scalability.

OvenMediaEngine supports the Origin-Edge structure for cluster configuration and provides scalability. Also, you can set Origin as Primary and Secondary in OvenMediaEngine for HA.

Origin-Edge Configuration

The OvenMediaEngine running as edge pulls a stream from an external server when a user requests it. The external server could be another OvenMediaEngine with OVT enabled or another stream server that supports RTSP.

The OVT is a protocol defined by OvenMediaEngine to relay stream between Origin-Edge and OVT can be run over SRT and TCP. For more information on the SRT Protocol, please visit the SRT Alliance site.

Origin

OvenMediaEngine provides OVT protocol for passing streams from the origin to the edge. To run OvenMediaEngine as Origin, OVT port, and OVT Publisher must be enabled as follows :

<Server version="5">
<Bind>
<Publishers>
<OVT>
<Port>9000</Port>
</OVT>
</Publishers>
<Bind>
<VirtualHosts>
<VirtualHost>
<Applications>
<Application>
...
<Publishers>
<OVT />
</Publishers>
</Application>
</Applications>
</VirtualHost>
</VirtualHosts>
</Server>

Edge

The role of the edge is to receive and distribute streams from an origin. You can configure hundreds of Edge to distribute traffic to your players. As a result of testing, a single edge can stream 4-5Gbps traffic by WebRTC based on AWS C5.2XLarge. If you need to stream to thousands of people, you can configure and use multiple edges.

The edge supports OVT and RTSP to pull stream from an origin. In the near future, we will support more protocols. The stream pulled through OVT or RTSP is bypassed without being encoded.

In order to re-encode the stream created by OVT and RTSP, the function to put into an existing application will be supported in the future.

To run OvenMediaEngine as Edge, you need to add Origins elements to the configuration file as follows:

<VirtualHosts>
<VirtualHost>
<Origins>
<Origin>
<Location>/app/stream</Location>
<Pass>
<Scheme>ovt</Scheme>
<Urls><Url>origin.com:9000/app/stream_720p</Url></Urls>
</Pass>
</Origin>
<Origin>
<Location>/app/</Location>
<Pass>
<Scheme>OVT</Scheme>
<Urls><Url>origin.com:9000/app/</Url></Urls>
</Pass>
</Origin>
<Origin>
<Location>/</Location>
<Pass>
<Scheme>RTSP</Scheme>
<Urls><Url>origin2.com:9000/</Url></Urls>
</Pass>
</Origin>
</Origins>
</VirtualHost>
</VirtualHosts>

The <Origin>is a rule about where to pull a stream from for what request.

The <Origin>has the ability to automatically create an application with that name if the application you set in <Location> doesn't exist on the server. If an application exists in the system, a stream will be created in the application.

The automatically created application by <Origin> enables all providers but if you create an application yourself, you must enable the provider that matches the setting as follows.

<VirtualHosts>
<VirtualHost>
<Origins>
<Origin>
<Location>/this_application/stream</Location>
<Pass>
<Scheme>OVT</Scheme>
<Urls><Url>origin.com:9000/app/stream_720p</Url></Urls>
</Pass>
</Origin>
<Origin>
<Location>/this_application/rtsp_stream</Location>
<Pass>
<Scheme>RTSP</Scheme>
<Urls><Url>rtsp.origin.com/145</Url></Urls>
</Pass>
</Origin>
</Origins>
<Applications>
<Application>
<Name>this_application</Name>
<Type>live</Type>
<Providers>
<!-- You have to enable the OVT provider
because you used the ovt scheme for configuring Origin. -->
<OVT />
<!-- If you set RTSP into Scheme,
you have to enable RTSPPull provider -->
<RTSPPull />
</Providers>

For a detailed description of Origin's elements, see:

Location

Origin is already filtered by domain because it belongs to VirtualHost. Therefore, in Location, set App, Stream, and File to match except domain area. If a request matches multiple Origins, the top of them runs.

Pass

Pass consists of Scheme and Url.

<Scheme> is the protocol that will use to pull from the Origin Stream. It currently can be configured as OVTor RTSP.

If the origin server is OvenMediaEngine, you have to set OVTinto the <Scheme>.

You can pull the stream from the RTSP server by setting RTSPinto the<Scheme>. In this case, the <RTSPPull> provider must be enabled. The application automatically generated by Origin doesn't need to worry because all providers are enabled.

Urls is the address of origin stream and can consist of multiple URLs.

Rules for generating Origin URL

The final address to be requested by OvenMediaEngine is generated by combining the configured Url and user's request except for Location. For example, if the following is set

<Location>/edge_app/</Location>
<Pass>
<Scheme>ovt</Scheme>
<Urls><Url>origin.com:9000/origin_app/</Url></Urls>
</Pass>

If a user requests http://edge.com/edge_app/stream, OvenMediaEngine makes an address to ovt: //origin.com: 9000/origin_app/stream.

Load Balancer

When you are configuring Load Balancer, you need to use third-party solutions such as L4 Switch, LVS, or GSLB, but we recommend using DNS Round Robin. Also, services such as cloud-based AWS Route53, Azure DNS, or Google Cloud DNS can be a good alternative.