Optimizing Memory Usage for Scaling Agent Processes in LiveKit
Problem Description:
I have an agent process that currently uses around 50MB of resident memory (RES). I need to scale this system to handle 1,000 rooms simultaneously, and if each room results in a separate agent process, this would lead to a total memory usage of:
1,000 rooms * 50MB per agent = 50GB of memory
This memory consumption is far too high for my resources, and as I add more logic to the agent, the memory usage could increase even further. The goal is to efficiently manage memory while still supporting the required number of rooms.
I need a solution that allows me to reduce the memory overhead, scale effectively, and handle 1,000 or more rooms without using such a large amount of memory.
env livekit server: 1.7.2 livekit agent: 0.10.2
Thanks for your response.
The agent I am using is the minimal-agent from the example folder.
this is expected. the agent has to load silero VAD as well as webrtc libraries.
your server will not be able to handle 1k concurrent conversations, due to CPU required to run these agents