In WebRTC, when the number of TURN servers have to be increased (horizontal scaling) due to increase in traffic, there seems to be two approaches to tackle this.
In either approach I take, there is no guarantee that all participants in the same room/group will be connected to the same TURN server. I was wondering if this is okay? Is communication between TURN and clients stateless such that peers can be connected to any one of the available TURN servers, and relay of data can still happen?
TURN simply opens a (udp) port on the TURN server. The TURN server will unwrap the STUN packets the client sends it (either STUN send indications or channels) and send them to the remote end. The remote end may be another TURN server but the TURN server does not care -- nor does the client. In terms of protocols used this looks like this:
Client --(STUN)-->TURN Server --("raw" udp)-->Another TURN Server--(STUN)-->Second client
Client --(STUN)-->TURN Server --("raw" udp)-->Second client
Note that both clients might be using TURN over TCP to talk to their respective TURN server but the allocations typically happen over udp (in webrtc).
The first approach is more common, it works better in cases where participants are assigned to the closest TURN server location which may be different if the participants are from different continents.