nginx-rtmp-module icon indicating copy to clipboard operation
nginx-rtmp-module copied to clipboard

Weird behaviour while using many streams

Open the-poor-gamer-124 opened this issue 2 years ago • 0 comments

Hello, i have an nginx instance with 800 streams, running AMD Ryzen 9 5950X 3.4GHz + 128gb ram (used as ramdisk for nginx rtmp) but some channels get "stuck" - that is, they either reset often or dont work at all

My config is as following

worker_processes 50; error_log /usr/local/mediacp/log/nginx-rtmp/error.log error; events { worker_connections 40396; } error_log /usr/local/nginx/logs/error.log;

rtmp { timeout 15s; drop_idle_publisher 15s;

server {

    listen 1935;
    chunk_size 4000;

    access_log off;
                    application cdn {
        live on;

hls_continuous on ;#Continuous mode. hls_cleanup on ; #Delete redundant slices hls_nested on ; #nested mode hls_fragment_naming timestamp; push_reconnect 4;

        hls on;
        hls_path /tmp/cdn;
       #          hls_fragment 3;
       hls_playlist_length 60;
        deny play all;

                # exec ln -sf /tmp/hls/$name/index.m3u8 /tmp/hls/$app/$name/playlist.m3u8;

    }

}

}

HTTP can be used for accessing RTMP stats

and i added the following sysctl patches

fs.file-max = 100000 net.ipv4.ip_local_port_range = 1024 65000 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_recycle = 0 net.ipv4.tcp_slow_start_after_idle = 0 net.ipv4.tcp_fin_timeout = 15 net.ipv4.tcp_max_tw_buckets = 400000 net.ipv4.tcp_no_metrics_save = 1 net.ipv4.tcp_syn_retries = 2 net.ipv4.tcp_synack_retries = 2 net.ipv4.tcp_rmem = 4096 87380 16777216 net.ipv4.tcp_wmem = 4096 65536 16777216 net.ipv4.tcp_max_syn_backlog = 65536 net.core.somaxconn = 16384 net.core.netdev_max_backlog = 16384

net.core.rmem_max = 1048576 net.core.rmem_default=1048576 net.ipv4.udp_mem = 8388608 12582912 16777216 net.core.somaxconn = 65535 net.core.netdev_max_backlog = 900000

net.ipv4.conf.all.accept_redirects = 0 net.ipv4.conf.all.secure_redirects = 0 net.ipv4.conf.all.send_redirects = 0

net.ipv4.tcp_keepalive_time = 1800 net.ipv4.tcp_keepalive_intvl = 15 net.ipv4.tcp_keepalive_probes = 5 net.ipv4.tcp_max_syn_backlog = 4096 net.ipv4.tcp_orphan_retries = 0 net.ipv4.netfilter.ip_conntrack_max = 1048576 net.ipv4.tcp_timestamps = 1 net.ipv4.tcp_no_metrics_save = 1

net.ipv4.tcp_max_tw_buckets = 65536 net.ipv4.tcp_tw_recycle = 1 net.ipv4.tcp_tw_reuse = 0 net.ipv4.tcp_max_syn_backlog = 131072 net.ipv4.tcp_syn_retries = 3 net.ipv4.tcp_synack_retries = 3 net.ipv4.tcp_retries1 = 3 net.ipv4.tcp_retries2 = 8 net.ipv4.tcp_max_orphans = 65536 net.ipv4.tcp_fin_timeout = 10 net.ipv4.tcp_low_latency = 1 net.ipv4.tcp_syncookies = 0

also set ulimit -c to unlimitd, what might cause those channels not working?

the-poor-gamer-124 avatar Aug 23 '22 18:08 the-poor-gamer-124