Need help testing significant memory optimizations

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)!

1 Like

Sounds great Nazar, congrats!!

What’s the easiest way to install your branch on a server? Could you provide some instructions?

Standard way you install something from GitHub, just replace mediasoup version with github:nazar-pc/mediasoup#memory-optimizations and it should pull the right version.

Did you have a chance to test yet?

I’ll test it next week

Hey all, I’ve been running a few load/validation tests over the PR branch for the past couple of days to help with the testing process a bit.

Been talking with @nazar-pc via mail about the testing process but would like to share the results I’ve got so far here.

It’d be a fairly long one if I dumped everything on a Discourse post, so I’ll put a tl;dr with a link to a Notion page with more detailed test infos.

  • Comparison tests were done against the 3.9.2 release tag
  • Current branch HEAD (e534014) seems to have a memory leak regression (@nazar-pc pinpointed the commit/is aware)
  • Commit 3f8d0e6 behaves as expected
    • Improvements in overall memory usage for the test plans I ran were massive (up to, roughly, 10% of total used memory seen in 3.9.2 depending on the scenario [see Test 1 in the Notion link down below])
    • I’ve seen no crashes or unexpected behavior from workers in that commit
    • There seems to be a marginal CPU usage improvement as well [see Test 1 in the Notion link down below]; but the margin it’s too small to assert anything. However, it’s safe to assert that there shouldn’t be any regressions on that area.
  • The test data (graphs, test scenarios etc) can be accessed through: mediasoup: testing memory improvements

s,

prlanzarin

2 Likes