I am getting this warning - WARNING livekit.agents...
# ask-ai
q
I am getting this warning - WARNING livekit.agents: process memory usage is high. But right now no calls are going through livekit, then how come the memory usage could be high?
t
Thanks for reaching out, Harsh. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
You're seeing the warning because agent processes keep prewarmed resources in memory even when no calls are active. Why this happens • Agents often load models/plugins (VAD, STT, TTS, LLMs, frameworks like PyTorch/ONNX) during a prewarm step and keep them resident so new sessions start fast. • Each agent job runs in its own process; idle processes still hold memory for those loaded resources. • This baseline memory use can trigger the "process memory usage is high" warning even with no active media. What you can do now • Check whether your agents use heavy models/plugins (e.g., Silero VAD) that are preloaded. • Reduce the number of idle processes by adjusting
num_idle_processes
. • Only preload essential models in your
prewarm
function so idle memory is smaller. If memory continues to grow over time or exceeds system capacity, we can dig into prewarm logic, inspect process memory profiles, and look for leaks. Would you like steps to check which models are loaded or guidance on changing
num_idle_processes
? Sources: Agent server options | LiveKit docs | Deploying to custom environments | LiveKit Docs
q
In this case increasing the number of pods won't help right. We have to increase the memory available for each pod
t
You're correct—adding more pods alone won't stop the "process memory usage is high" warning for an individual pod. Each pod has its own memory footprint, and the warning is triggered by high memory usage inside a pod's process. What to do instead • Increase the memory limit/requests for the affected pod(s) so each has enough RAM to hold prewarmed models/plugins. • Or reduce the memory each pod needs by changing agent behavior: ◦ Lower
num_idle_processes
. ◦ Avoid preloading large models in
prewarm
or preload only essential components. ◦ Replace heavy model runtimes with lighter alternatives if possible. If you want, I can help decide whether to raise pod memory, shrink prewarm usage, or both—tell me which models/plugins your agents load or the current
num_idle_processes
and pod memory limits.
q
I have specified num_idle_processes variable. Silero vad model is pre loaded
t
Thanks — that helps. Since you’ve set
num_idle_processes
and you preloaded the Silero VAD, here’s a focused plan. Why the warning still appears • Silero VAD stays resident after prewarm and consumes significant RAM per agent process, so each pod’s baseline memory stays high even when idle. • Reducing pod count (more pods) won’t lower per-pod memory; the warning is per-process/per-pod. Recommended actions (short-term → long-term) 1. Increase pod memory limits/requests so each pod can comfortably hold the prewarmed Silero model. This directly prevents the per-pod warning. 2. Tune
num_idle_processes
downward if you can tolerate slightly higher cold-start latency; fewer idle processes = less total idle memory per pod. 3. Modify prewarm behavior: ◦ Preload only essential parts of Silero (if possible) or lazy-load the heavier components on first use. ◦ Move heavy models to a shared model-serving service (if architecture allows) so agents fetch audio-level results instead of hosting the full model. 1. Consider lighter VAD alternatives or smaller model variants if maintaining low pod memory is a priority. Next step Would you like commands/examples to: • Update Kubernetes pod memory requests/limits, • Change
num_idle_processes
safely, or • Inspect current process memory usage to quantify how much Silero is using?
q
I have not specified num_idle_processes variable
t
Thanks — since you preload Silero VAD and haven’t set
num_idle_processes
, two things are likely happening: the agent processes keep the Silero model resident in memory, and the system is using the default number of idle processes (which can be higher than you expect), so each pod’s baseline RAM is higher. What to do next • Set
num_idle_processes
to a lower value to reduce how many idle agent processes keep the model in memory (tradeoff: slightly higher cold starts). • Increase pod memory requests/limits so each pod can hold the prewarmed Silero model without triggering the warning. • If you want further reductions, change prewarm behavior to lazy-load Silero or preload only essential parts, or serve the model from a shared inference service. Would you like an example of safe
num_idle_processes
values to try and Kubernetes manifest snippets to raise pod memory?
q
yes
t
Great — below are concise, practical examples you can try: one for
num_idle_processes
values to test, and a Kubernetes pod/container resource snippet to raise memory. Suggested
num_idle_processes
values to try • Start with
1
(lowest idle memory, highest cold-start latency). • If 1 causes too many cold starts, try
2
or
3
. • Monitor memory and cold-start latency, then pick the smallest value that keeps latency acceptable. Kubernetes container resource example • Update your Deployment/StatefulSet container spec to increase requests/limits. Replace names and values to match your cluster and expected model footprint.
Copy code
spec:
  containers:
    - name: livekit-agent
      image: your-registry/livekit-agent:tag
      resources:
        requests:
          memory: "2Gi"
          cpu: "500m"
        limits:
          memory: "4Gi"
          cpu: "1"
      env:
        - name: NUM_IDLE_PROCESSES
          value: "1"
Notes • Set
requests.memory
to the minimum memory each pod should get at scheduling time and
limits.memory
to the maximum the pod may use. • If Silero plus runtime needs more than 2Gi, raise these values — observe actual RSS per process to choose a safe value. • After applying changes, watch pod memory usage and agent logs for the warning to confirm resolution. Would you like a kubectl command to patch an existing Deployment or a manifest tuned for your current pod memory usage if you share the current values?