Presenting Mafalda SFU

Mafalda SFU is a massively vertical and horizontal scalable SFU built on top of Mediasoup. This allow to have (theorically) unlimited sized WebRTC-based video room calls.

Mafalda aproach is simple: just create a MafaldaRouter instance, and it will scale itself to use all the server CPU cores and create the connections to other servers. From both developers and users PoV, it’s like using a single Mediasoup Router instance, but running in a server with an humongous big CPU. Not only that, but since Mafalda schedule algorythm try to minimize the number of used connections and CPUs, you can run multiple MafaldaRouter instances in the same server, and Mafalda will balance the resources between them. And when they are not needed anymore, connections get closed and the CPU cores are freed, so you can stop the servers to reduce costs, all this without needing to administer them and almost without configuration.

The main features of Mafalda are:

  • Fully automated: you only need to create a MafaldaRouter instance, and it will take care of everything else
  • Optimiced resources consumption on half-used machines compared to libraries using other architectures, allowing to host multiple rooms on the same machine without needing to pre-assign resources, that could lead to a suboptimal usage
  • Designed to support adding a new server to the cluster, without needing to restart the whole cluster. It also can make use automatically of new added CPU cores in a server (if it has support) without needing to restart the process
  • API heavily influenced by Mediasoup, so it’s easy to understand, use and migrate from your existing code
  • 100% acceptance tests code coverage for both lines, branches statements and functions. This has shown to be very useful to find bugs until the very last moment

I’ve been working on Mafalda since March 2021, and so far I’ve fully implemented vertical scaling, and got to a point where both API and code are stable and ready to start testing in real enviroments.

At the same time, I’m currently working on horizontal scaling too. So far I’ve implemented a client library with the same API of local Mafalda instances, and designed an events-based RPC protocol that replicate the state of the remote Mediasoup objects and the Mafalda instances, allowing to work with them as if they were local ones. That would help not only to easily migrate deployments from local to cluster environments, but also to simplify automated management of horizontal scaling and inter-server connections.

@ibc sorry if this is offtopic, I’ve not found any sub-forum for third-party libraries in the Mediasoup ecosystem, but since I’m trying to promote Mafalda as a commercial product, I thought this sub-forum could be the best fit of all the available ones. Don’t mind if you move it to offtopic sub-forum, just wanted to know if this is the correct place to do these announcements.

I see it ok in this category :ok_hand:

1 Like

great, thank you :slight_smile: