Answer the question
In order to leave comments, you need to log in
Why does the stream start to slow down?
Greetings, the task was to develop a server for online broadcasting (stream), googling found the solution nginx-rtmp-module , it works stably, there are no problems with it, the problem is different.
And so there is an HLS stream via OBS and a server where it all works and is distributed, here is the nginx config .
There is a problem with a large number of users connected to the stream, if in a situation where a couple of dozen users are watching the stream, .ts files are given in about 200-300ms, and if 500-1000 users connect to the server, then the return is stretched from 5 seconds to 20 seconds
I thought that the problem was the lack of bandwidth, each .ts file weighs about 2mb, in general, I created a bunch of servers with this nginx config:
nginx.conf
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=pagecache:50m inactive=50m max_size=1G;
proxy_cache_valid 200 301 302 304 5m;
proxy_cache_key "$request_uri";
proxy_hide_header "Set-Cookie";
proxy_ignore_headers "Cache-Control" "Expires";
proxy_cache_use_stale error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_cache pagecache;
location ~ \.ts$ {
proxy_pass http://сервер-стрима;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_buffering on;
add_header X-Cache-Status $upstream_cache_status;
add_header X-Cache-Key $request_uri;
}
Answer the question
In order to leave comments, you need to log in
Then there is a problem with returning the playlist of the .m3u8 file, since new .ts files are added to it, it must be given directly from the stream server, then it cannot be cached
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question