Configuring TURN with mediasoup involving scaling

Is the relationship between TURN server (coTURN for example) and mediasoup enabled backend server one to one ?!

On AWS, I was able to use a network load balancer to route data to a TURN server which has UDP relay endpoints as (40000-49999). Now since my coTURN and mediasoup were on the same system this configuration worked.

However, if we bring in the concept of scaling where mediasoup backend servers scale up each with its port range of (40000-49999), how would a single TURN server could possibly serve/relay the increasing number of ports then ?! (which makes me feel whether the relationship is then one to one between them)

Please feel free to share your thoughts or point any shortcomings in my understanding.
Thanks

Seems overall like a bad idea, you don’t need to load-balance the servers like this. Your routing app will take care of all this and more. The TURN server is only needed when the connection is blocked so really no use to include it. Up to you though it does act optional on stun failure; if not mistaken. :slight_smile:

The idea here is to understand whether coTURN will be a part of my mediasoup enabled backend server instance. As far as number of ports are considered it would draw out to a 1-1 relationship. Here considering that I do not want to expose all the rtc port range to the internet. Traffic is received at the NLB which can send it to required instances. Now the metrics can be custom as well (I do follow your scaling ideas in the forum).
Initially my hunch was to keep single TURN and multiple mediasoup enabled backend servers, but now it is boiling down to bringing turn and mediasoup on same server.
However, not too sure about it yet.

(Also, do you think a network load balancer is over the top for scaling purposes?!)

You may want to learn about network protocols and security, exposed ports mean nothing and should never unless what you’re serving out that port is insecure. You will always be susceptible to denial of service so easy debunk; do what you want with your RTC Port Range.

Most won’t need a TURN server to connect so it’d be an extra cost/burden on you to ensure it’s there. Another way to look at this is if an ISP or company had blocked RTC connections it’s not ideal to find work arounds (you get people into trouble so best to not fight blocks, and a VPN can fix all this for individuals at motels/hotels running blocks.

Load balancing doesn’t work out fully here, optimal though for keeping your stateless front-end happy.
What’s more suitable is a quality signal server, to route your traffic properly. The media-servers cannot act stateless on their own but through signaling can be. So yeah over-the-top.
GL.

1 Like