recommended mediasoup cluster topology?

I am trying to implement mediasoup clusters behide NLB servers. There are three topologies I can think of:

  1. NLB server distribute rooms to different mediasoup nodes, users in the same room are connected to the same mediasoup server

  2. NLB server evenly distribute users across mediasoup nodes, so a room contains multiple servers. Say UserA connecting to ServerA, UserB connecting to ServerB, and so on. So UserA will create a sendtraport to ServerA to produce media, and it will create multiple receivetransports to ServerB … ServerN to receive media

  3. NLB server evenly distribute users across mediasoup nodes, a user is still creating sendtransport and receivetransport with the same mediasoup server, and each mediasoup nodes use pipeToRouter to pipe media between servers.

My thought is that option1 is most easy to implement, but it does not really scale geographically by like CDN. Option2 is not good in terms of scaling geographically, and its difficult to implement. Options3 seems the most promising one, but I am not sure if it is the good scenario to use pipeToRouter, and will it create mass network traffic within mediasoup servers?

What is the recommended option?

Thanks in advance

As far as you have 2 transports on client (to receive and to send), you can use it to configure your scalability.
For example:

  • connect all producing transports to single server (prodicer node)
  • make relay from this server to another servers (consuming nodes)
  • connect consuming transports to consuming nodes

Also you may want to to make consumption of producers on server side (consume producer / re-enccode / send to relay nodes), to make multi-server signal stable and save good quality.

To make geo scalability, you can use co-turn approach. you can place your turns near-user and send signal to mediasoup via internal network of your ISP, that is always better

1 Like

Thanks for the reply. That is basically what I am going to do.

I want to clarify the geo scalability part: I understand we can put a co-turn server near user and relay media via co-turn to mediasoup server. But how about we put a mediasoup server near user and use inter-server version of pipeToRouter(say pipeToServer) to pipe the media to the other mediasoup node near the receiving user?

What is the difference of the two approaches? I think the latter is more purer mediasoup implementation and may be more controllable

If you want to interconnect servers using full-mesh, you have to forward every producer of every server to every server, making very limited grow.
You can use geo nodes using media soup. This nodes will be placed nearly user and then forward signal to producer nodes. But i think co-turn have similar functionality from the box.