createPipeTransport , PipeTransport

I read mediasoup/Router.ts at 6c9a9424352d5504f9b1f7acbd077f6be9368d7a · versatica/mediasoup · GitHub to implement createPipeTransport between two media soup worker nodes.
I see that pipeRouter is using previously created pipeTransport for piping.
Does that mean we can share pipe transport between multiple users and avoid creating duplicate transport between two workers?
Duplicate Pipe Transport means Let’s say i have User A, B, C , D in Worker 1 and W, X , Y, Z in Worker 2 for Room 1. Right now i am creating piping for all these users between two workers. that means piping for A-W, A-X, A-Y, A-Z , B-W and so on… because that is what written in the documentation. But i want to improve that and i was hoping for some solutions.

Is it possible to use createPipeTransport between two worker only once and then we can share it for multiple producers and consumers ?

This is not the right way, to share a producer_1 from worker_1 to worker_2 you will use only one pipe transport and after that producer_1 will also be available in worker_2 and then you can consume it multiple time from worker_2 just like normal way.

So if user W, X, Y, Z from worker_2 want to consumer producer_1 from worker_1 then use one pipe transport to pipe producer_1 to worker_2 and let user W, X, Y, Z consume the piped producer after that.

Piping is the process of piping a producer from one router to another router. Forget about the users which you just mentioned and just use one pipe transport to produce one producer from router 1 to router 2 this is it.

About whether pipe transport allows multiple producers to be piped between workers, It should but I am not sure.

  1. Create a PipeTransport1 in worker1.
  2. Créate a PipeTransport2 in worker2.
  3. Produce and consume as much as you want in PipeTransport1 and PipeTransport2.
1 Like

Oh, That means i am just creating too many pipetransport. Thank you I will optimize this.
Is there any drawback of having single pipetransport if too many users are connected does it lag or anything i should take care while writing the code ? since i didn’t find anything related to lag or conditions in doc.

Thank you

Why should the docs say that something doesn’t produce lag if it doesn’t produce any lag?

There is no problem with single pipetransport if the workers are not going to reach the full capactity.

In general you will be needing multiple pipetransports in a call (meeting) to scale properly. You can’t just create one pipetransport between 2 workers and produce, consume unlimited time, because workers have their capacity limit as per cpu core capacity.

Lets say you have created pipetransport between worker_1, worker_2 and you have piped 2 producers from worker_1 to worker_2 now worker_2 has reached around 98% of capacity.

So far so good but now you want to pipe one more producer from worker_1 to worker_2 in that case if you try to pipe one more producer to worker_2 then worker_2 will cross it’s capacity and can cause lagging issue which you have concerns about.

What you will do then?

You will consider using another worker worker_3 and create another pipetransport between worker_1 and worker_3 and pipe the producer.