agents icon indicating copy to clipboard operation
agents copied to clipboard

Optimizing Memory Usage for Scaling Agent Processes in LiveKit

Open leejiliang opened this issue 1 year ago • 1 comments

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.

subProcess

env livekit server: 1.7.2 livekit agent: 0.10.2

Thanks for your response.

leejiliang avatar Oct 24 '24 06:10 leejiliang

The agent I am using is the minimal-agent from the example folder.

leejiliang avatar Oct 24 '24 06:10 leejiliang

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

davidzhao avatar Oct 29 '24 19:10 davidzhao