Hello everyone,
I've been self-hosting LiveKit and running into issues at scale, specifically with egress composite recording.
I have an API that creates a room, dispatches an agent, and initializes egress composite. If any of these steps fail, the API raises an error. At scale (~40 concurrent users), the API slows down significantly mainly due to waiting on egress. CPU usage on the egress server peaks at ~30% and memory at ~50%, so resources don't seem to be the bottleneck.
What I'm trying to understand: what is the actual bottleneck here?
Autoscaling or pre-warming a few egress servers would likely help, but I want to diagnose root cause first.
I've considered skipping the await on egress initialization to make the API respond faster, but the issue is that audio recording is required for my use case, so I can't just fire-and-forget and move on.
Any guidance appreciated!