nginx rtmp-moduleで長時間配信を目指す ack_windowの調整 50

今日も懲りずにack_windowの調整をしてみる。
youtubeよりかは切断回数が減っているから、どうなんだろう。効果あるのか?

さらにack_windowサイズを小さくしてみる。

エンコーダ|⇒LAN⇒|nginx rtmp1| ⇒Internet⇒ |nginx rtmp2| ⇒|クライアント

という構成で、Pushで試験する。
注視しているのはrtmp1サーバ。切断されるか?

rtmp1はエンコーダからのデータを3つのサーバへpushするだけ

rtmp {
   server {
      listen 1935;

      access_log logs/rtmp_access.log;

      application live {
         live on;
         push rtmp://sakura.hoge.jp/live/test?user=live&pass=********;
         push rtmp://video. hoge.jp/live/test?user=live&pass=********;
         push rtmp://a.rtmp.youtube.com/live2/********;
     }
   }
}

 

rtmp2サーバは以下2つ どちらも同じack_windowサイズにし、インターネット回線経路での違いも確認する。

さくらのクラウドvmでack_windowを小さくしてみる。デフォルト5000000のところ1/100000に設定。

rtmp {
        server {
        listen 1935;
        ack_window 50;
        buflen 30s;
        drop_idle_publisher 5s;
        publish_notify on;
        notify_method get;

           access_log logs/rtmp_access.log combined;

           application live {
                live on;
        }
}

Cloudnでは、ack_windowを小さくしてみる。デフォルト5000000のところ1/100000に設定。

rtmp {
        server {
           listen 1935;
           buflen 30s;
           publish_notify on;
           drop_idle_publisher 5s;
           ack_window 50;

           access_log logs/rtmp_access.log combined;

           application live {
                live on;
                on_publish http://localhost/publishauth/auth.php;
                notify_method get;

                on_play http://localhost:8080/on_play;
           }
}

 

エンコーダ設定
ビットレート512kbps
キーフレーム2秒間隔
640×360
FPS20
音声ビットレート 128Kbps

結果
さくらのクラウド 3回切断
youtube 3回切断
Cloudn 2回切断

微妙に良くなったのか?って感じるけど。どうだろう。さらに検証を進めてみたい。

root@StreamRouter:/usr/local/nginx/logs# egrep 'disconnect' error.log
2017/01/20 18:01:17 [info] 2871#0: *2 disconnect, client: sakura.hanako.jp/live/test?user=live&pass=*********, server: ngx-relay
2017/01/20 18:01:17 [debug] 2871#0: *2 relay: play disconnect app='live' name='test'
2017/01/20 18:01:17 [debug] 2871#0: *2 relay: play left after disconnect app='live' name='test': 2
2017/01/20 20:18:49 [info] 2871#0: *3 disconnect, client: video.hanako.jp/live/test?user=live&pass=*********, server: ngx-relay
2017/01/20 20:18:49 [debug] 2871#0: *3 relay: play disconnect app='live' name='test'
2017/01/20 20:18:49 [debug] 2871#0: *3 relay: play left after disconnect app='live' name='test': 2
2017/01/21 01:27:20 [info] 2871#0: *5 disconnect, client: sakura.hanako.jp/live/test?user=live&pass=*********, server: ngx-relay
2017/01/21 01:27:20 [debug] 2871#0: *5 relay: play disconnect app='live' name='test'
2017/01/21 01:27:20 [debug] 2871#0: *5 relay: play left after disconnect app='live' name='test': 2
2017/01/21 01:33:27 [info] 2871#0: *4 disconnect, client: a.rtmp.youtube.com/live2/********, server: ngx-relay
2017/01/21 01:33:27 [debug] 2871#0: *4 relay: play disconnect app='live2' name='test'
2017/01/21 01:33:27 [debug] 2871#0: *4 relay: play left after disconnect app='live2' name='test': 2
2017/01/21 03:56:08 [info] 2871#0: *8 disconnect, client: a.rtmp.youtube.com/live2/********, server: ngx-relay
2017/01/21 03:56:08 [debug] 2871#0: *8 relay: play disconnect app='live2' name='test'
2017/01/21 03:56:08 [debug] 2871#0: *8 relay: play left after disconnect app='live2' name='test': 2
2017/01/21 07:30:54 [info] 2871#0: *9 disconnect, client: a.rtmp.youtube.com/live2/********, server: ngx-relay
2017/01/21 07:30:54 [debug] 2871#0: *9 relay: play disconnect app='live2' name='test'
2017/01/21 07:30:54 [debug] 2871#0: *9 relay: play left after disconnect app='live2' name='test': 2
2017/01/21 08:22:56 [info] 2871#0: *7 disconnect, client: sakura.hanako.jp/live/test?user=live&pass=*********, server: ngx-relay
2017/01/21 08:22:56 [debug] 2871#0: *7 relay: play disconnect app='live' name='test'
2017/01/21 08:22:56 [debug] 2871#0: *7 relay: play left after disconnect app='live' name='test': 2
2017/01/21 08:22:56 [info] 2871#0: *6 disconnect, client: video.hanako.jp/live/test?user=live&pass=*********, server: ngx-relay
2017/01/21 08:22:56 [debug] 2871#0: *6 relay: play disconnect app='live' name='test'
2017/01/21 08:22:56 [debug] 2871#0: *6 relay: play left after disconnect app='live' name='test': 1