sergey-dryabzhinsky / nginx-rtmp-module

NGINX-based Media Streaming Server
http://nginx-rtmp.blogspot.com
BSD 2-Clause "Simplified" License
1.02k stars 216 forks source link

Scaling Nginx RTMP #297

Open Jeyanthinath opened 5 years ago

Jeyanthinath commented 5 years ago

Hi,

Can you guys provide the detail instruction of how to scale for huge load with multiple servers

I can get some information from (https://github.com/sergey-dryabzhinsky/nginx-rtmp-module/issues/127#issuecomment-218379800) , but a details set of instructions will be really handy.

note: I am trying to achieve a streaming server and save the hls file from input stream and stream back to the user.

if am running multiple instances to save the data on same location, will the hls files will be overwritten / how the nginx from different servers/processes will track the file name on hls ?

br jeyanthi

ctaity commented 5 years ago

You need develop your own solution i think. We up docker containers via api, and in the proccess you can save the ip address of the docker, redirect the rtmp stream to the instance, and later in the instance upload the hls files to a s3, etc.

misiek08 commented 5 years ago

I highly recommend using HLS, because scaling HTTP is easy and well developed solution. There are many options (CDNs, bunch of caching proxies and LB in front). RTMP protocol is much harder to scale and for example shifting traffic requires custom made solutions.

wt., 23.07.2019, 16:16 użytkownik ctaity notifications@github.com napisał:

You need develop your own solution i think. We up docker containers via api, and in the proccess you can save the ip address of the docker, redirect the rtmp stream to the instance, and later in the instance upload the hls files to a s3, etc.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sergey-dryabzhinsky/nginx-rtmp-module/issues/297?email_source=notifications&email_token=AADOT5RJ7ZUNAV6FI2OLKILQA4HFVA5CNFSM4IGASXWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2TIJ2Y#issuecomment-514229483, or mute the thread https://github.com/notifications/unsubscribe-auth/AADOT5RODTTFJA7JTOSUK6LQA4HFVANCNFSM4IGASXWA .

Jeyanthinath commented 5 years ago

@ctaity and @misiek08 thanks for your answer.

can anyone give me a pointer or a strategy for how to setup multiple Nginx instances to share the HLS save folder location without conflict

And is session stickiness is necessary for that strategy?

ctaity commented 5 years ago

@ctaity and @misiek08 thanks for your answer.

can anyone give me a pointer or a strategy for how to setup multiple Nginx instances to share the HLS save folder location without conflict

And is session stickiness is necessary for that strategy?

@Jeyanthinath HI @Jeyanthinath contact me @ ctaity@gmail.com hangouts.

misiek08 commented 5 years ago

I don't exactly understand what do you mean by sharing. Simplest setup is to have one "ingest" node, where you publish RTMP and get HLS. Then you set up multiple servers with proxy_pass and proxy_cache. Sharing single datastore creates a SPOF and scaling might not work as expected.

śr., 21.08.2019, 14:57 użytkownik Jeyanthinath MuthuRam < notifications@github.com> napisał:

@ctaity https://github.com/ctaity and @misiek08 https://github.com/misiek08 thanks for your answer.

can anyone give me a pointer or a strategy for how to setup multiple Nginx instances to share the HLS save folder location without conflict

And is session stickiness is necessary for that strategy?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sergey-dryabzhinsky/nginx-rtmp-module/issues/297?email_source=notifications&email_token=AADOT5XH7EHYBX6QHK56IWTQFU3SBA5CNFSM4IGASXWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4ZSEMQ#issuecomment-523444786, or mute the thread https://github.com/notifications/unsubscribe-auth/AADOT5TH3BICS2ZGRVNP243QFU3SBANCNFSM4IGASXWA .