Using Overlay Network for UDP Traffic (AKA: Janus on Docker Swarm / Kubernetes)

Hello everyone,

I’ve recently started using the Janus WebRTC gateway behind NAT, and my clients utilize Coturn for relaying traffic to Janus instances. (For more details, please refer to my previous post: link to post.) This configuration has made my setup more complex but potentially opens new possibilities. Previously, using Docker Swarm’s overlay network for my Janus instances was not feasible due to the impracticality of opening a large number of ports. However, now that I’m employing Coturn, I only need to open a single port (3478) to the external world. Coturn can then use the Docker Swarm overlay network to relay traffic to my Janus instances.

This approach offers significant advantages: a) It eliminates the need for a separate macvlan network for Janus instances in my on-premises (baremetal) setup, and b) It removes the restriction of one instance per host on AWS and other cloud providers, where I previously had to use the host network for Janus instances to prevent port conflicts etc.

Additionally, this setup allows me to leverage the service discovery features of Docker Swarm (currently, I’m using Consul for this purpose).

However, I have reservations about the efficiency of this configuration. I’m uncertain whether high-throughput UDP traffic is well-suited for overlay networks. I would greatly appreciate your insights and thoughts on this matter. Thank you in advance for your assistance.

Kaan.

If Janus itself is asking for relay candidates, then yes, it will be incredibly inefficient.

1 Like

Hi Lorenzo,

Thank you for your quick response, as always! :slight_smile:

To clarify, Janus itself doesn’t have STUN or TURN configured; it’s the clients (browsers) that utilize Coturn. Right now, both Janus and Coturn are on the same local network, with Coturn listening outside world on port 3478 and relaying traffic to the Janus instances.

In our current configuration, Janus operates on a Macvlan network, while Coturn uses the host network. This setup functions well, but I’m curious about the potential impacts of moving both services to an overlay network. My main concern is whether the overlay network would introduce significant overhead due to packet encapsulation/decapsulation and other processes.

Thanks for your insights!

1 Like

So, @lorenzo, do you think it’s advisable to place Janus instances and Coturn within Swarm’s overlay network? Has anyone previously implemented such setup?