Choosing a TURN network
— Broadcast Bridge, TURN Network, STUN, firewalls, Twilio, Xirsys, Cloudflare, Metred.ca, ExpressTURN, ICEPerf, Nimble Ape, WebRTC, livestream, streaming, broadcasting, NAT, Everycast Labs — 4 min read
One of Broadcast Bridge’s features is being able to choose your own TURN network but what is a TURN network and why should you care about it?
If you’re looking to plug and play, Broadcast Bridge has got a default TURN network and so can run sessions via TURN; you don’t need to change any settings if you don’t want to. But what if you do want to?
This post will help you understand what a TURN network is, why they’re needed and why you might choose to change the default when setting up a Broadcast Bridge Room.
What is TURN?
We utilise a technology called WebRTC fairly heavily within Broadcast Bridge; it’s how we get low latency interaction between everyone within a Broadcast Bridge session. WebRTC is an amazing technology that allows people to connect no matter where they are, no matter what their device is, just by using their browser that’s already loaded onto their device and even allows bidirectional transfer of data from behind firewalls. This is where TURN comes in.
TURN stands for Traversal Using Relays around NAT which is a pretty concise way of explaining what it does. TURN is a ‘relay’ for dealing with tricky NAT scenarios; primarily where firewalls don’t like WebRTC endpoints connecting to one another directly - this can be for many reasons but it’s usually because of security concerns or a carrier grade NAT (seen often in mobile phone networks). It is highly common to see TURN usage increase in highly secure networks such as financial and medical institutions and in government buildings.
How much of your traffic goes via TURN?
Unless you’re working within those pesky high-security networks I mentioned previously, your TURN usage is likely going to be in the low 0-7% of your traffic; most see at most 3-4% of their traffic go via a TURN server.
Choosing a TURN network
Today we support Twilio and Xirsys as TURN network providers and with the recent announcement from Cloudflare that they are entering this marketplace, we’ll soon be adding them to our list of available partners.
A good question is: how do we decide which provider is the default TURN network for Broadcast Bridge? Who do we choose to be the default for all of our users who don’t want to choose themselves?
Primarily it comes down to good connectivity and who we think will enable those connections to happen that normally wouldn’t be able to connect - for us historically that’s been Twilio. Twilio’s public IP addresses are part of many exception lists in many firewalls due to their history in providing SIP connectivity to institutions all over the world and so it made perfect sense for Twilio to be our default. However, times are changing and we’ve got new players in this market - Cloudflare are just launching their network, Metered.ca and ExpressTURN have popped up as available networks too.
The ability to make a connection that otherwise would have failed is primary in our decisions but now with five networks to choose from we need to take a more granular approach to these decisions going forward. Some of these metrics include:
- time to first byte (essentially the latency of adding a TURN server into the data path)
- throughput availability
- total cost for sending that data over TURN in the first place
A great question we’re often asked is “why don’t you just run your own TURN network?” and the answer to this one is pretty simple - to offer the service that our users need, we’d spend more time on building out a TURN network and maintaining it and less time on producing new features on our core product. Utilising a TURN network gives us the flexibility to use whichever is right for our users and serve them better.
In the coming days our sister business, Nimble Ape, will be launching a service called IcePerf at JanusCon that does exactly this for each of the TURN networks - enabling us, and others, to be able to make these decisions.
Should I send all my traffic over TURN?
This is a question we get asked a lot. And as always, the answer is “it depends”:
Do you know your users are going to be in one of those pesky networks and you want to speed up their connection times? Then absolutely, yes, send your traffic over TURN.
Do you want to get your data off of the ‘public internet’ as quickly as possible to decrease the chance of packet loss and increased latency? Then, yes, use TURN.
A lot of the time the added cost just isn’t justifiable. We’re hoping that ICEPerf really allows us more visibility into the range of benefits TURN has for end users.
Get started with Broadcast Bridge
If you’re producing livestreams for a business with lots of layers of security and need a TURN solution, try Broadcast Bridge. There’s a 7-day free trial for you to test out all the features. We don’t require your card details, and if you do choose to sign up after that trial, you’re not locked in - you can cancel after just one month.
If you have any questions you can always email us as [email protected].
- Dan and the Everycast Labs team