I was working on some memory optimizations and got exciting results, but since changes are very invasive I’d like for more people to test them.
The results are 3x decrease in calls to system allocator (35x decrease in temporary allocations), 6x decrease in memory consumption by worker and slight improvement in CPU usage too.
Most of remaining allocations are coming from bandwidth estimation code of libwebrtc which I decided to skip for now.
With that in Rust videoroom example a room with 5 participants, each of which has audio and 720p@30 video sent to everyone else, the whole application (WebSocket server, worker, everything) consumes roughly 6.5 MiB of residential memory.
Please test it in your projects if possible and I’d like to know any feedback about issues you may encounter.
Branch to use: GitHub - nazar-pc/mediasoup at memory-optimizations
UPD: Halved memory consumption again (savings on audio packets)!