Implementing multi-core (clustering) in SFU

150 views
Skip to first unread message

hem...@kortobaa.com

unread,
Dec 4, 2020, 10:00:49 PM12/4/20
to medooze
Hello, 

I'm using Medooze SFU to build a room with 100+ participants and using Nodejs cluster & Redis to share data between clusters, but I'm stuck on the endpoint step, how I can create an endpoint for the same room in another Nodejs cluster??

Am tested a room with 100 participants, but the CPU reached the max after 40 participants, cuz the endpoint working on 1 core, my server has 8 cores

Any idea of how I can duplicate endpoint throw multi-core or sharing incoming/outgoing streams data throw multiple endpoints??

am using SFU example

Sergio Garcia Murillo

unread,
Dec 5, 2020, 3:27:26 AM12/5/20
to hem...@kortobaa.com, medooze
You just need to create one endpoint per CPU core and load balance the participants between them.

Would be interesting to capture a flamegraph of the running SFU at max load before and after the change for comparing the CPU usage and detect potential bottlenecks (it doesnt affect the running conferences) :


Best regards
Sergio



--
You received this message because you are subscribed to the Google Groups "medooze" group.
To unsubscribe from this group and stop receiving emails from it, send an email to medooze+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/medooze/9e1f9ad0-366f-4142-9f57-bf922ad95990n%40googlegroups.com.

hem...@kortobaa.com

unread,
Dec 8, 2020, 7:44:50 AM12/8/20
to medooze
Sergio,  Thank you for the quick reply ^^

Now I already implemented endpoint per CPU core, but am stuck on another point, when another user joining the room new outgoing stream will create for other participants in the room, but the outgoing streams need to attach to the new participant's incomingstream

Am just saw your code & saw you get video/audio tracks from incoming stream to attach to the outgoing, but Redis can't share objects with functions/methods

Here we go, any idea of how I can share incoming stream using Redis pubsub to other endpoints 

Sergio, Thank you so much for your support ^^

Sergio Garcia Murillo

unread,
Dec 10, 2020, 6:11:01 AM12/10/20
to med...@googlegroups.com
You can send data between streams in different endpoints setting up aew transports + incoming/outgoing streams  in the same way that you do with a browser.

Best regards
Sergio

hem...@kortobaa.com

unread,
Dec 10, 2020, 10:17:14 AM12/10/20
to medooze
Thanks for your time Sergio, but I have some questions

1- You mean sending data between streams by using SDP ?? or get StreamInfo from an incoming stream ??
2- After getting data in another endpoint, I need to create a new incoming stream in another endpoint to attach to the outgoing stream ??
3- Can you tell me a small example of these steps like .... "create an incoming stream,  get stream info, etc"


Sergio Garcia Murillo

unread,
Dec 10, 2020, 8:04:12 PM12/10/20
to hem...@kortobaa.com, medooze


El jue., 10 dic. 2020 16:17, hem...@kortobaa.com <hem...@kortobaa.com> escribió:
Thanks for your time Sergio, but I have some questions

1- You mean sending data between streams by using SDP ?? or get StreamInfo from an incoming stream ??

you can do either of them

2- After getting data in another endpoint, I need to create a new incoming stream in another endpoint to attach to the outgoing stream ??

exactly 

3- Can you tell me a small example of these steps like .... "create an incoming stream,  get stream info, etc"

no, I dont have anything public, sorry

hem...@kortobaa.com

unread,
Dec 13, 2020, 2:06:20 PM12/13/20
to medooze
Thank you  Sergio for your helping

Now after I got SDP in another endpoint, am created new transport then set the local/remote properties, and created an incoming stream 
After that, I created an outgoing stream and attach it to the newly incoming stream, but I got an empty stream on the client-side.

I think I missed something here, can you help me, please

Sergio Garcia Murillo

unread,
Dec 13, 2020, 3:55:01 PM12/13/20
to hem...@kortobaa.com, medooze
That should be it, enable more blogs level and chech the stats of each stream to double check where media is Boeing stopped

hem...@kortobaa.com

unread,
Dec 14, 2020, 9:32:18 PM12/14/20
to medooze
Am tested everything in another endpoint but this won't work, can you help me, please

These are my steps after creating a new endpoint & get SDP info

  • const offer = SDPInfo.parse(data.sdp);
  • const transport = this.endpoint.createTransport(offer);
  • transport.setRemoteProperties(offer);
  • let answer = offer.answer({
                dtls: transport.getLocalDTLSInfo(),
                ice: transport.getLocalICEInfo(),
                candidates: this.endpoint.getLocalCandidates(),
                capabilities: this.capabilities,
    });
  •  transport.setLocalProperties(answer);
  • incomingStream = transport.createIncomingStream(offer.getFirstStream())
  • participant.addStream(incomingStream)

hem...@kortobaa.com

unread,
Dec 20, 2020, 10:22:18 AM12/20/20
to medooze
Another question, please, when I transfer SDP to another endpoint, which SDP you talk about??
The SDP received from the client or SDP from the endpoint.createOffer?? or Streaminfo from the created incoming stream in first endpoint ??

leeo...@gmail.com

unread,
Dec 21, 2020, 12:50:54 AM12/21/20
to medooze

hem...@kortobaa.com

unread,
Dec 21, 2020, 11:32:55 AM12/21/20
to medooze
Thank you so much Leeo ^^ working perfectly
Reply all
Reply to author
Forward
0 new messages