this post was submitted on 18 Nov 2023
1 points (100.0% liked)

Data Hoarder

24 readers
1 users here now

We are digital librarians. Among us are represented the various reasons to keep data -- legal requirements, competitive requirements, uncertainty of permanence of cloud services, distaste for transmitting your data externally (e.g. government or corporate espionage), cultural and familial archivists, internet collapse preppers, and people who do it themselves so they're sure it's done right. Everyone has their reasons for curating the data they have decided to keep (either forever or For A Damn Long Time (tm) ). Along the way we have sought out like-minded individuals to exchange strategies, war stories, and cautionary tales of failures.

founded 10 months ago
MODERATORS
 

Hi.

I was trying to find a way to prevent server crash every time I do a streaming.

Basically I have a popular movie website and every time I release an episode I get minimum 30k live viewers and whenever I pass 8k live viewers, 20gbit bandwidth becomes useless. I tried to put 5mbps bandwidth limit occasionally to prevent server crash but it didn’t do much. And I don’t want to rent 100 gbit network bandwidth every time I release an episode. So my question is, is there a way to deal with 30 to 60k live viewers only by using 20 gbit network or I just need to rent 100 gbit network occasionally?

Thank you!

top 16 comments
sorted by: hot top controversial new old
[–] [email protected] 1 points 10 months ago

You can always look to implement webtorrent. It does not work everywhere, but it works very well.

Basically how it works it's that you have a streemable file, you make a torrent, and a javascript client on the browser it's capable of downloading and streaming it.

https://webtorrent.io/

[–] [email protected] 1 points 10 months ago

From the live video delivery, this is definitely above my expertise, though it sounds like a fun problem to have. Suffering from success and all that.
The only bit I can contribute is automated deployment is your friend. Many providers will allow very easy to use scripted deployment. I don't know what kind of computer power you need to push, but a VPS with a Gb (in theory) pipe is very cheap, and if you need more more powerful VPS or bare metal a lot of providers allow hourly billing, some even hourly billing for bare metal if you need a lot of compute with it- some providers will not take kindly to you pounding a shared compute instance at 100% CPU. What you should look into do is automated deployment...may k8s, maybe something else. Before you start a stream that might have that many viewers, you can just deploy like 40 instances. You don't even have to worry about bandwidth with most providers since you're just running a short time. When your stream is over, all of the instances are destroyed and the billing is stopped to the nearest hour.

You can seriously do what you need for a couple hours for a few bucks if you don't need a bunch of compute, more if you need compute but still very reasonable. The non-compute heavy go 1Gb/s connections as low as not even a whole cent an hour, and you can distribute this across multiple providers to give more geographic locations.
The one caution I would give with this method is before you invest time in making a platform work for your setup is to actually grab an instance manually and benchmark the connection. Some are 1Gb/s, but will throttle to less during peak times, so test over time too. Know what you are dealing with and how many instances you need.

[–] [email protected] 1 points 10 months ago (1 children)

Use a more efficient type of video codec / audio. Going from basic hardware encoded H.264 to something like x264 can increase efficiency greatly. I have no idea what your setup is. Or moving onto VP9/AV1/H.265

[–] [email protected] 1 points 10 months ago

H.264 and x264 are the same thing. H.264 is the name of the math standard. x264 is the name of an open source software that implemented that math.

[–] [email protected] 1 points 10 months ago (1 children)

I wouldn’t expect a server crash from bandwidth limitations. A few questions: Do you have metrics on the bandwidth saturation and server resources? Have you isolated the issue to be certainly with bandwidth?

[–] [email protected] 1 points 10 months ago

All the time whenever the crash happens, bandwidth usage goes up all the way and website stops responding.

[–] [email protected] 1 points 10 months ago

Out-of-the-box solution: implement a queue on your website. As soon as it hits 7k viewers, new viewers must wait in a queue until older sessions have closed. They do the same for popular MMOs.

[–] [email protected] 1 points 10 months ago

Raise the price until have less than 8k viewers.

[–] [email protected] 1 points 10 months ago (1 children)

Maybe you need multiple servers to handle the demand with a load balancer.

[–] [email protected] 1 points 10 months ago

Also, you can cache the movie in a RAM-disk, just the latest movie.

[–] [email protected] 1 points 10 months ago

You are going to need some CDN relays or something. 30k live viewers will destroy a single connection.

[–] [email protected] 1 points 10 months ago

If you're looking for an out of the box solution you could just throw it at CloudFlare Stream.

https://www.cloudflare.com/en-au/products/cloudflare-stream/

[–] [email protected] 1 points 10 months ago

Why are you trying to do it the hard way?

[–] [email protected] 1 points 10 months ago (1 children)

Just use a video streaming service like YouTube, twitch or kick?

[–] [email protected] 1 points 10 months ago
[–] [email protected] 1 points 10 months ago

50000 users at 20gb is 400kbit per second per second? That ain't gonna cut it even for potato quality. The recommended bit rate for 480p is 5 times higher the recommended bit rate for 720 ten times higher. So you maxing out at 5k users makes sense.

Now I am astonished a single server can service 5000 streams at rge same time. That's some scalable server software.