I have a digital ocean server for serving RTMP and hls live streaming.Is there any way I can restrict output bandwith for each stream to 1mbps Or 1.5mpbs.
I already tried wondershaper but it is limiting the entire server bandwidth but I need some way to restrict bandwidth only for rtmp and hls streams.
Personaly,I would use either
cgroups+tcoriptablesfor that.On my servers I have used a tool named
wondersharperhttps://github.com/magnific0/wondershaper/blob/master/wondershaperThis can limit the bandwith / throughput on a given network-interface. My NGINX server is listing on a virtual network interface that is limited in its bandwith.
Another way of doing it (but not tested) are
iptablesand thehashlimitextension.https://ipset.netfilter.org/iptables-extensions.man.html
While researching the ipbtables part I found this
http://info.iet.unipi.it/~luigi/dummynet/
Documentation can be found here:\
https://www.freebsd.org/cgi/man.cgi?query=ipfw&manpath=FreeBSD+9-current&format=html
That one looks pretty interessting though.