Site Tools


Hotfix release available: 2025-05-14b "Librarian". upgrade now! [56.2] (what's this?)
Hotfix release available: 2025-05-14a "Librarian". upgrade now! [56.1] (what's this?)
New release available: 2025-05-14 "Librarian". upgrade now! [56] (what's this?)
Hotfix release available: 2024-02-06b "Kaos". upgrade now! [55.2] (what's this?)
Hotfix release available: 2024-02-06a "Kaos". upgrade now! [55.1] (what's this?)
New release available: 2024-02-06 "Kaos". upgrade now! [55] (what's this?)
Hotfix release available: 2023-04-04b "Jack Jackrum". upgrade now! [54.2] (what's this?)
Hotfix release available: 2023-04-04a "Jack Jackrum". upgrade now! [54.1] (what's this?)
New release available: 2023-04-04 "Jack Jackrum". upgrade now! [54] (what's this?)
Hotfix release available: 2022-07-31b "Igor". upgrade now! [53.1] (what's this?)
Hotfix release available: 2022-07-31a "Igor". upgrade now! [53] (what's this?)
New release available: 2022-07-31 "Igor". upgrade now! [52.2] (what's this?)
New release candidate 2 available: rc2022-06-26 "Igor". upgrade now! [52.1] (what's this?)
New release candidate available: 2022-06-26 "Igor". upgrade now! [52] (what's this?)
Hotfix release available: 2020-07-29a "Hogfather". upgrade now! [51.4] (what's this?)
New release available: 2020-07-29 "Hogfather". upgrade now! [51.3] (what's this?)
New release candidate 3 available: 2020-06-09 "Hogfather". upgrade now! [51.2] (what's this?)
New release candidate 2 available: 2020-06-01 "Hogfather". upgrade now! [51.1] (what's this?)
New release candidate available: 2020-06-01 "Hogfather". upgrade now! [51] (what's this?)
Hotfix release available: 2018-04-22c "Greebo". upgrade now! [50.3] (what's this?)
Hotfix release available: 2018-04-22b "Greebo". upgrade now! [50.2] (what's this?)
rtmp_scaling

RTMP Scaling

Study

* It was found that RTMP Origin servers can only relay to multiple edges. These edges can be useful for 
  Geographically distributing the content.
* There is no internal intelligent and dynamic loadbalancing in any available solutions, except commercial solutions like 
  Wozwa or Red5Pro again these are custom plug-ins or code.
* This area still requires more research and we are progressing.
                                
                                                                     |                    #######################
 |~~~~~~~~~~~~~~~|                                                   |<------------------>#    RTMP Server 1    #
 |               |                #################                  |                    #######################
 |   Clients     |<--------------># Load Balancer # <--------------->|
 |               |                #################                  |                    #######################  
 |_______________|                                                   |<------------------>#    RTMP Server 2    #
                                                                     |                    #######################

Specification of Test environment

Platform           - CentOS 6.x/Debian/Ubuntu

Load Balancer      - Haproxy           - Version - v1.6.x (generic configuration will do)

RTMP Streamer      - Nginx-RTMP-Module compiled with Nginx (any version) (https://github.com/arut/nginx-rtmp-module)

RTMP Stress test   - flazr (java client) (http://flazr.com)


Note : There is no need to modify code unless we need dynamic load balancing, 
       as nginx-rtmp-module can publish statistics about connections and uptime.
       

Installing Nginx with RTMP-Module

yum install gcc g++ automake wget epel-release pcre-devel pcre openssl-devel git

cd /opt

git clone https://github.com/arut/nginx-rtmp-module

wget http://nginx.org/download/nginx-1.8.0.tar.gz

tar xvf nginx-1.8.0.tar.gz

cd nginx-1.8.0

./configure --add-module=/opt/nginx-rtmp-module/ --with-http_ssl_module --prefix=/usr/local/nginx-streaming/

make

make install

Installing Haproxy

Please refer : https://wiki.exphosted.com/doku.php/haproxy_changes - Roll-back scenario - script section (we can use any version of haproxy)

Haproxy Configuration

global
	user root
	group root
	spread-checks 1

defaults
	timeout client		30s
	timeout server		30s
	timeout connect		1s
	timeout queue		2s
	max-keep-alive-queue    1900
	option tcp-smart-accept 
	option tcp-smart-connect
	option tcpka
	option srvtcpka
	option clitcpka
	option redispatch
	retries 3
	maxconn 2000
	no option log-health-checks
	log		127.0.0.1	local1

frontend rtmp 
	bind    192.168.56.12:1935 transparent
	maxconn 1900 
	tcp-request inspect-delay 2s	
	default_backend rtmp_end

backend rtmp_end
	mode   tcp
	option tcplog
	balance roundrobin
	stick store-request src
	stick-table type ip size 200k expire 20m
	stick on src
	server  edge1 192.168.56.10:1935 check port 1935 weight 10 minconn 10 check maxconn 1000
	server  edge2 192.168.56.11:1935 check port 1935 weight 10 minconn 10 check maxconn 1000

Nginx Configuration

worker_processes  1;
 
events {
    worker_connections  1024;
}
 
rtmp {
    server {
        listen 1935;
 
        chunk_size 2000;

# RTMP URL  : rtmp://<IPADDR>/<application Name>/<media_file>.mp4|flv

        application learnexa {

	live on;

# Path where the MP4 or FLV's are kept

        play /usr/local/nginx-streaming/streams;

        }
    }
}

http{
server {
	listen 80;
	location / {
		root /usr/local/nginx-streaming/html;
	}
	location /control {
		rtmp_control all;
	}
	location /stat {
		rtmp_stat live;
	}
}	
}
rtmp_scaling.txt · Last modified: 2018/08/31 16:16 (external edit)