High RSS(Resident Set Size) Growth & Memory Not Released Until Restart on Mediasoup Servers

Hi Team,

We’ve been running multiple Mediasoup server instances in production (a server with 8 GB RAM). On one server, we hit HostOutOfMemory, and the server crashed, though user counts are balanced across servers.

Observations

  • mediasoup-worker processes steadily grow to ~10–12 GB RSS under load.

  • RSS does not shrink when rooms or users disconnect.

  • Memory shows up as Inactive_anon (allocator/libstdc++ behavior).

  • Questions

  1. Is this memory plateau/retention expected behavior in Mediasoup under high fan-out + retransmission?

  2. Are there recommended configuration tweaks (e.g., retransmission history buffer, maxIncomingBitrate, auto-pause) that help reduce RSS footprint without impacting quality?

  3. For large deployments, is the standard approach to recycle workers (rolling restarts) to release memory back to the OS?

  4. Any best practices from the community on room assignment (e.g., weighting rooms by producers/fan-out) to avoid uneven memory load across nodes?

Our current mitigations are:

  • Restart workers when RSS >70%

  • Plan rolling restarts off-peak

mediasoup: “3.12.0”

Node 20.14.0

Socket.io “4.4.0”

ioredis “^4.16.1”

Would appreciate confirmation if this is the expected lifecycle, or if we might be missing some tuning that would reduce memory retention.

Thanks in advance
Harjeet Singh

Greetings, have you configured the rtpRetransmissionBufferSize parameter?

Allocator has released it internally, but Linux still keeps it attached to the process until pressure or an explicit trim. This is expected behavior trimming could have performance issues if done to often.